public static Matrix3d RotationArbitraryAxis(Vector3d axis, double radian) { Vector3d vector3d = axis.Normalize(); double num = Math.Cos(radian); double double_ = Math.Sin(radian); Matrix3d matrix3d_ = new Matrix3d(num); Matrix3d matrix3d_2 = Matrix3d.smethod_2(Vector3d.TensorProduct(vector3d, vector3d), 1.0 - num); Matrix3d matrix3d_3 = Matrix3d.smethod_2(Matrix3d.CrossProductMatrix3d(vector3d), double_); return(Matrix3d.smethod_0(Matrix3d.smethod_0(matrix3d_, matrix3d_2), matrix3d_3)); }
public bool IsSkewTo(Line line) { Vector3d vector3d = new Vector3d(line.Point - this.point_0); if (vector3d.Norm < Global.AbsoluteEpsilon) { return(false); } Vector3d vector3d2 = vector3d.Normalize(); Vector3d vector3d3 = this.DirectionVector.Normalize(); Vector3d vector3d4 = line.DirectionVector.Normalize(); double a = vector3d2.X * vector3d3.Y * vector3d4.Z + vector3d2.Y * vector3d3.Z * vector3d4.X + vector3d2.Z * vector3d3.X * vector3d4.Y; double b = vector3d2.Z * vector3d3.Y * vector3d4.X + vector3d2.Y * vector3d3.X * vector3d4.Z + vector3d2.X * vector3d3.Z * vector3d4.Y; return(!Global.AlmostEquals(a, b)); }
public static double AngleCosine(Vector3d a, Vector3d b) { Vector3d vector3d = a.Normalize(); Vector3d vector3d2 = b.Normalize(); double num = vector3d.x * vector3d2.x + vector3d.y * vector3d2.y + vector3d.z * vector3d2.z; if (num > 1.0) { num = 1.0; } if (num < -1.0) { num = -1.0; } return(num); }
public PointSet method_3(Circle circle) { if (!circle.IsCoplanarTo(this)) { return(null); } if (circle == this) { return(null); } PointSet result = new PointSet(); if (circle.point_0 == this.point_0) { return(result); } Circle circle2; Circle circle3; if (this.double_0 > circle.double_0) { circle2 = this; circle3 = circle; } else { circle3 = this; circle2 = circle; } Vector3d vector3d = new Vector3d(circle3.point_0 - circle2.point_0); double norm = vector3d.Norm; double scalar = (circle2.double_0 * circle2.double_0 - circle3.double_0 * circle3.double_0 + norm * norm) / (2.0 * norm); Point point = circle2.point_0 + scalar * vector3d.Normalize().ToPoint(); Line line = new Line(point, Vector3d.Cross(vector3d, this.vector3d_0)); return(this.method_1(line)); }
public void method_0() { Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; try { //TCPlugin.LicenseManager.CheckValid("FULL"); ObjectId[] objectId_ = CommandLineQuerries.SelectPoints(false); Class1.string_0 = CommandLineQuerries.SpecifyProjectionDirection(Class1.string_0); ngeometry.VectorGeometry.Vector3d vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0); string a; if ((a = Class1.string_0.ToUpper()) != null) { if (!(a == "X")) { if (!(a == "Y")) { if (!(a == "Z")) { if (!(a == "U")) { if (!(a == "2P")) { goto IL_150; } vector3d = CommandLineQuerries.Specify2PDirection().BasisVector[2]; vector3d = vector3d.Normalize(); } else { vector3d = Conversions.GetUCS().BasisVector[2].Normalize(); } } else { vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0); } } else { vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0); } } else { vector3d = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0); } Point point = new Point(0.0, 0.0, 0.0); ngeometry.VectorGeometry.Plane plane = new ngeometry.VectorGeometry.Plane(point, vector3d); CoordinateSystem coordinateSystem_ = new CoordinateSystem(plane); Class1.smethod_0(objectId_, coordinateSystem_); return; } IL_150: throw new System.Exception("Invalid option keyword."); } catch (System.Exception ex) { editor.WriteMessage("\n" + ex.Message); } }
public void MinAreaEnclosingRectnagleCommand() { Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; try { //LicenseManager.CheckValid("FULL"); ObjectId[] idArray = CommandLineQuerries.SelectPoints(false); CMD_MinAreaEnclosingRectangle.string_0 = CommandLineQuerries.SpecifyProjectionDirection(CMD_MinAreaEnclosingRectangle.string_0); ngeometry.VectorGeometry.Vector3d vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0); string a; if ((a = CMD_MinAreaEnclosingRectangle.string_0.ToUpper()) != null) { if (!(a == "X")) { if (!(a == "Y")) { if (!(a == "Z")) { if (!(a == "U")) { if (!(a == "2P")) { goto IL_150; } vector3d = CommandLineQuerries.Specify2PDirection().BasisVector[2]; vector3d = vector3d.Normalize(); } else { vector3d = Conversions.GetUCS().BasisVector[2].Normalize(); } } else { vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0); } } else { vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0); } } else { vector3d = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0); } Point point = new Point(0.0, 0.0, 0.0); ngeometry.VectorGeometry.Plane plane = new ngeometry.VectorGeometry.Plane(point, vector3d); CoordinateSystem actualCS = new CoordinateSystem(plane); CMD_MinAreaEnclosingRectangle.ComputeMinAreaEnclosingRectangle(idArray, actualCS); return; } IL_150: throw new System.Exception("Invalid option keyword."); } catch (System.Exception ex) { editor.WriteMessage("\n" + ex.Message); } }
public static Vector3d Bisector(Vector3d a, Vector3d b) { return(a.Normalize() + b.Normalize()); }