Author Topic: Math stuff for Propeller-Heads  (Read 3455 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Math stuff for Propeller-Heads
« on: May 26, 2007, 12:05:34 AM »
If you have the hat ....
.... Something to dream about.

and then there is the
Autodesk.AutoCAD.Geometry.Matrix2d
Autodesk.AutoCAD.Geometry.Matrix3d  ... which will have you in raptures  :wink:
Quote
class System.Math
{
    // Fields
      doubleRoundLimit;
      E = 2.7182818284590451;
      maxRoundingDigits = 15;
      PI = 3.1415926535897931;
      roundPower10Double;

    // Methods
      
      Abs(value);   
      Acos(d);
      Asin(d);
      Atan(d);
      Atan2(y, x);
      BigMul( a, b);
      Ceiling(d);
      Cos(d);
      Cosh(value);
      DivRem(a, b, out result);
      Exp(d);
      Floor(d);
      IEEERemainder(x, y);      
      Log(d);
      Log10(d);
      Max(val1, val2);
      Min(val1, val2);      
      Pow(x, y);
      Round(d);
      Sign(value);
      Sin(a);
      Sinh(value);
      Sqrt(d);
      Tan(a);
      Tanh(value);
      Truncate(d);
}
Quote
struct Autodesk.AutoCAD.Geometry.Vector2d
{
   public Vector2d(double[] xy);
   public Vector2d(double x, double y);
   public Vector2d TransformBy(Matrix2d leftSide);
   public Vector2d RotateBy(double angle);
   public Vector2d Mirror(Vector2d line);
   public Vector2d Add(Vector2d v);
   public Vector2d Subtract(Vector2d v);
   public Vector2d DivideBy(double value);
   public Vector2d MultiplyBy(double value);
   public Vector2d Negate();
   public Vector2d GetPerpendicularVector();
   public double GetAngleTo(Vector2d vector);
   public Vector2d GetNormal();
   public Vector2d GetNormal(Tolerance tolerance);
   public bool IsUnitLength();
   public bool IsUnitLength(Tolerance tolerance);
   public bool IsZeroLength();
   public bool IsZeroLength(Tolerance tolerance);
   public bool IsParallelTo(Vector2d vector);
   public bool IsParallelTo(Vector2d vector, Tolerance tolerance);
   public bool IsCodirectionalTo(Vector2d vector);
   public bool IsCodirectionalTo(Vector2d vector, Tolerance tolerance);
   public bool IsPerpendicularTo(Vector2d vector);
   public bool IsPerpendicularTo(Vector2d vector, Tolerance tolerance);
   public bool IsEqualTo(Vector2d vector);
   public bool IsEqualTo(Vector2d vector, Tolerance tolerance);
   public double DotProduct(Vector2d v);
   
   public sealed override bool Equals(object obj);   
   public static bool operator !=(Vector2d a, Vector2d b);
   public static bool operator ==(Vector2d a, Vector2d b);
   public static Vector2d operator +(Vector2d a, Vector2d b);
   public static Vector2d operator -(Vector2d a, Vector2d b);
   public static Vector2d operator *(Matrix2d a, Vector2d b);
   public static Vector2d operator *(double factor, Vector2d a);
   public static Vector2d operator *(Vector2d a, double factor);
   public static Vector2d operator /(Vector2d a, double factor);
   public static Vector2d operator -(Vector2d a);
   
   public sealed override int GetHashCode();
   public sealed override string ToString(string format, IFormatProvider provider);
   public string ToString(IFormatProvider provider);
   public sealed override string ToString();
   public double[] ToArray();
   
   public static Vector2d XAxis { get; }
   public static Vector2d YAxis { get; }
   public double X { get; }
   public double Y { get; }   
   public double this[int i] { get; }   
   public double Angle { get; }   
   public double Length { get; }
   public double LengthSqrd { get; }   
}
Quote
struct Autodesk.AutoCAD.Geometry.Vector3d
{   
   public Vector3d(PlanarEntity plane, Vector2d vector2d);
   public Vector3d(double[] xyz);
   public Vector3d(double x, double y, double z);
   public Vector2d Convert2d(PlanarEntity plane);
   public double AngleOnPlane(PlanarEntity plane);
   public Vector3d TransformBy(Matrix3d leftSide);
   public Vector3d RotateBy(double angle, Vector3d axis);
   public Vector3d Mirror(Vector3d normalToPlane);
   public Vector3d MultiplyBy(double value);
   public Vector3d Add(Vector3d v);
   public Vector3d Subtract(Vector3d v);
   public Vector3d DivideBy(double value);
   public Vector3d Negate();
   public Vector3d GetPerpendicularVector();
   public double GetAngleTo(Vector3d vector, Vector3d referenceVector);
   public double GetAngleTo(Vector3d vector);
   public Vector3d GetNormal();
   public Vector3d GetNormal(Tolerance tolerance);
   public bool IsUnitLength();
   public bool IsUnitLength(Tolerance tolerance);
   public bool IsZeroLength();
   public bool IsZeroLength(Tolerance tolerance);
   public bool IsParallelTo(Vector3d vector);
   public bool IsParallelTo(Vector3d vector, Tolerance tolerance);
   public bool IsCodirectionalTo(Vector3d vector);
   public bool IsCodirectionalTo(Vector3d vector, Tolerance tolerance);
   public bool IsPerpendicularTo(Vector3d vector);
   public bool IsPerpendicularTo(Vector3d vector, Tolerance tolerance);
   public double DotProduct(Vector3d v);
   public Vector3d CrossProduct(Vector3d vector);
   public Vector3d ProjectTo(Vector3d planeNormal, Vector3d projectDirection);
   public Vector3d OrthoProjectTo(Vector3d planeNormal);
   public bool IsEqualTo(Vector3d vector);
   public bool IsEqualTo(Vector3d vector, Tolerance tolerance);
   
   public sealed override bool Equals(object obj);
   public static bool operator !=(Vector3d a, Vector3d b);
   public static bool operator ==(Vector3d a, Vector3d b);
   public static Vector3d operator +(Vector3d a, Vector3d b);
   public static Vector3d operator -(Vector3d a, Vector3d b);
   public static Vector3d operator *(Matrix3d a, Vector3d b);
   public static Vector3d operator *(double factor, Vector3d a);
   public static Vector3d operator *(Vector3d a, double factor);
   public static Vector3d operator /(Vector3d a, double factor);
   public static Vector3d operator -(Vector3d a);
   
   public sealed override int GetHashCode();
   public sealed override string ToString(string format, IFormatProvider provider);
   public string ToString(IFormatProvider provider);
   public sealed override string ToString();
   public double[] ToArray();
   
   public double X { get; }
   public double Y { get; }
   public double Z { get; }
   public static Vector3d XAxis { get; }
   public static Vector3d YAxis { get; }
   public static Vector3d ZAxis { get; }   
   public double this[int i] { get; }   
   public double Length { get; }
   public double LengthSqrd { get; }   
   public int LargestElement { get; }   
}


Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

TonyT

  • Guest
Re: Math stuff for Propeller-Heads
« Reply #1 on: May 26, 2007, 06:05:33 PM »
And if consistency is important:

Autodesk.AutoCAD.Geometry.Tolerance
{
    public Tolerance(double equalVector, double equalPoint);
    public double EqualPoint { get; }
    public double EqualVector { get; }
    public static Tolerance Global { get; set; }
}


If you have the hat ....
.... Something to dream about.

and then there is the
Autodesk.AutoCAD.Geometry.Matrix2d
Autodesk.AutoCAD.Geometry.Matrix3d  ... which will have you in raptures  :wink:
Quote
class System.Math
{
    // Fields
      doubleRoundLimit;
      E = 2.7182818284590451;
      maxRoundingDigits = 15;
      PI = 3.1415926535897931;
      roundPower10Double;

    // Methods
      
      Abs(value);   
      Acos(d);
      Asin(d);
      Atan(d);
      Atan2(y, x);
      BigMul( a, b);
      Ceiling(d);
      Cos(d);
      Cosh(value);
      DivRem(a, b, out result);
      Exp(d);
      Floor(d);
      IEEERemainder(x, y);      
      Log(d);
      Log10(d);
      Max(val1, val2);
      Min(val1, val2);      
      Pow(x, y);
      Round(d);
      Sign(value);
      Sin(a);
      Sinh(value);
      Sqrt(d);
      Tan(a);
      Tanh(value);
      Truncate(d);
}
Quote
struct Autodesk.AutoCAD.Geometry.Vector2d
{
   public Vector2d(double[] xy);
   public Vector2d(double x, double y);
   public Vector2d TransformBy(Matrix2d leftSide);
   public Vector2d RotateBy(double angle);
   public Vector2d Mirror(Vector2d line);
   public Vector2d Add(Vector2d v);
   public Vector2d Subtract(Vector2d v);
   public Vector2d DivideBy(double value);
   public Vector2d MultiplyBy(double value);
   public Vector2d Negate();
   public Vector2d GetPerpendicularVector();
   public double GetAngleTo(Vector2d vector);
   public Vector2d GetNormal();
   public Vector2d GetNormal(Tolerance tolerance);
   public bool IsUnitLength();
   public bool IsUnitLength(Tolerance tolerance);
   public bool IsZeroLength();
   public bool IsZeroLength(Tolerance tolerance);
   public bool IsParallelTo(Vector2d vector);
   public bool IsParallelTo(Vector2d vector, Tolerance tolerance);
   public bool IsCodirectionalTo(Vector2d vector);
   public bool IsCodirectionalTo(Vector2d vector, Tolerance tolerance);
   public bool IsPerpendicularTo(Vector2d vector);
   public bool IsPerpendicularTo(Vector2d vector, Tolerance tolerance);
   public bool IsEqualTo(Vector2d vector);
   public bool IsEqualTo(Vector2d vector, Tolerance tolerance);
   public double DotProduct(Vector2d v);
   
   public sealed override bool Equals(object obj);   
   public static bool operator !=(Vector2d a, Vector2d b);
   public static bool operator ==(Vector2d a, Vector2d b);
   public static Vector2d operator +(Vector2d a, Vector2d b);
   public static Vector2d operator -(Vector2d a, Vector2d b);
   public static Vector2d operator *(Matrix2d a, Vector2d b);
   public static Vector2d operator *(double factor, Vector2d a);
   public static Vector2d operator *(Vector2d a, double factor);
   public static Vector2d operator /(Vector2d a, double factor);
   public static Vector2d operator -(Vector2d a);
   
   public sealed override int GetHashCode();
   public sealed override string ToString(string format, IFormatProvider provider);
   public string ToString(IFormatProvider provider);
   public sealed override string ToString();
   public double[] ToArray();
   
   public static Vector2d XAxis { get; }
   public static Vector2d YAxis { get; }
   public double X { get; }
   public double Y { get; }   
   public double this[int i] { get; }   
   public double Angle { get; }   
   public double Length { get; }
   public double LengthSqrd { get; }   
}
Quote
struct Autodesk.AutoCAD.Geometry.Vector3d
{   
   public Vector3d(PlanarEntity plane, Vector2d vector2d);
   public Vector3d(double[] xyz);
   public Vector3d(double x, double y, double z);
   public Vector2d Convert2d(PlanarEntity plane);
   public double AngleOnPlane(PlanarEntity plane);
   public Vector3d TransformBy(Matrix3d leftSide);
   public Vector3d RotateBy(double angle, Vector3d axis);
   public Vector3d Mirror(Vector3d normalToPlane);
   public Vector3d MultiplyBy(double value);
   public Vector3d Add(Vector3d v);
   public Vector3d Subtract(Vector3d v);
   public Vector3d DivideBy(double value);
   public Vector3d Negate();
   public Vector3d GetPerpendicularVector();
   public double GetAngleTo(Vector3d vector, Vector3d referenceVector);
   public double GetAngleTo(Vector3d vector);
   public Vector3d GetNormal();
   public Vector3d GetNormal(Tolerance tolerance);
   public bool IsUnitLength();
   public bool IsUnitLength(Tolerance tolerance);
   public bool IsZeroLength();
   public bool IsZeroLength(Tolerance tolerance);
   public bool IsParallelTo(Vector3d vector);
   public bool IsParallelTo(Vector3d vector, Tolerance tolerance);
   public bool IsCodirectionalTo(Vector3d vector);
   public bool IsCodirectionalTo(Vector3d vector, Tolerance tolerance);
   public bool IsPerpendicularTo(Vector3d vector);
   public bool IsPerpendicularTo(Vector3d vector, Tolerance tolerance);
   public double DotProduct(Vector3d v);
   public Vector3d CrossProduct(Vector3d vector);
   public Vector3d ProjectTo(Vector3d planeNormal, Vector3d projectDirection);
   public Vector3d OrthoProjectTo(Vector3d planeNormal);
   public bool IsEqualTo(Vector3d vector);
   public bool IsEqualTo(Vector3d vector, Tolerance tolerance);
   
   public sealed override bool Equals(object obj);
   public static bool operator !=(Vector3d a, Vector3d b);
   public static bool operator ==(Vector3d a, Vector3d b);
   public static Vector3d operator +(Vector3d a, Vector3d b);
   public static Vector3d operator -(Vector3d a, Vector3d b);
   public static Vector3d operator *(Matrix3d a, Vector3d b);
   public static Vector3d operator *(double factor, Vector3d a);
   public static Vector3d operator *(Vector3d a, double factor);
   public static Vector3d operator /(Vector3d a, double factor);
   public static Vector3d operator -(Vector3d a);
   
   public sealed override int GetHashCode();
   public sealed override string ToString(string format, IFormatProvider provider);
   public string ToString(IFormatProvider provider);
   public sealed override string ToString();
   public double[] ToArray();
   
   public double X { get; }
   public double Y { get; }
   public double Z { get; }
   public static Vector3d XAxis { get; }
   public static Vector3d YAxis { get; }
   public static Vector3d ZAxis { get; }   
   public double this[int i] { get; }   
   public double Length { get; }
   public double LengthSqrd { get; }   
   public int LargestElement { get; }   
}




Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Math stuff for Propeller-Heads
« Reply #2 on: May 26, 2007, 08:16:48 PM »
... and to save re-inventing the wheel ..
Code: [Select]
Autodesk.AutoCAD.Runtime.Converter
{
    // Methods   
    public static string AngleToString(double value);
    public static string AngleToString(double value, AngularUnitFormat units, int precision);
    public static string DistanceToString(double value);
    public static string DistanceToString(double value, DistanceUnitFormat units, int precision);
    public static double StringToAngle(string value);
    public static double StringToAngle(string value, AngularUnitFormat units);
    public static double StringToDistance(string value);
    public static double StringToDistance(string value, DistanceUnitFormat units);
}
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--