/// <summary> /// Method to constrcut the Plane 1 and Point A /// </summary> private void ConstructPlaneRedPlane1AndPointA() { ///Constructing Plane1 from Bottom Wishbone Points and the Top Front Pick-Up Point ///<remarks>Right now selection of these 3 points is random. Need to figure out how to select them properly</remarks> Plane1 = new Plane(BottomFrontInboard.Position.Clone() as Point3D, BottomRearInboard.Position.Clone() as Point3D, TopFrontInboard.Position.Clone() as Point3D); ///<summary>Creating a <see cref="Segment3D"/> using the <see cref="SteeringAxis"/> so that I can use the <see cref="Segment3D.IntersectWith(Plane, bool, out Point3D)"/> to compute the intersection of the Plane1 and Steering Axis</summary> Segment3D SteeringAxisSegment = new Segment3D(SteeringAxis.StartPoint.Clone() as Point3D, SteeringAxis.EndPoint.Clone() as Point3D); ///<summary>Computing the Intersection of the <see cref="SteeringAxis"/> with the <see cref="Plane1"/> which results in <see cref="PointA"/></summary> SteeringAxisSegment.IntersectWith(Plane1, true, out PointA); ///<summary>Determining the whether the <see cref="PointA"/> is above or below the Wishbones</summary> if (PointA.Y > UBJ_Rear.Position.Y && PointA.Y > TopFrontInboard.Position.Y && PointA.Y > TopRearInboard.Position.Y) { PointAPos = PositionOfPointA.AboveWishbones; } else if (PointA.Y < LBJ_Rear.Position.Y && PointA.Y < BottomFrontInboard.Position.Y && PointA.Y < BottomRearInboard.Position.Y) { PointAPos = PositionOfPointA.BelowWishbones; } ///<summary>Adding them to the VIewport as a Planar Entity</summary> PlanarEntity Plane1_Ent = new PlanarEntity(Plane1); Joint PointA_Ent = new Joint(PointA, 10, 2); PointA_Ent.Color = Color.AntiqueWhite; //cad1.viewportLayout1.Entities.AddRange(new Entity[] { Plane1_Ent, PointA_Ent }); }
/// <summary> /// Method to Construct the <see cref="PlaneB"/> and <see cref="PointB"/> /// </summary> private void ConstructPlaneBAndPointB() { ///<summary>Calculating the angle between the <see cref="PlaneRED"/> and the <see cref="Bisector2"/></summary> Angle Angle_Bis2_PlaneRED = SetupChangeDatabase.AngleInRequiredView(Custom3DGeometry.GetMathNetVector3D(LineForAngle_PlaneRED), Custom3DGeometry.GetMathNetVector3D(Bisector2), Custom3DGeometry.GetMathNetVector3D(new Line(InstantAxis.StartPoint, InstantAxis.EndPoint))); ///<summary>Calculating the angle between the <see cref="PlaneRED2"/> and the <see cref="Bisector2"/></summary> Angle Angle_Bis2_PlaneRED2 = SetupChangeDatabase.AngleInRequiredView(Custom3DGeometry.GetMathNetVector3D(LineForAngle_PlaneRed2), Custom3DGeometry.GetMathNetVector3D(Bisector2), Custom3DGeometry.GetMathNetVector3D(new Line(InstantAxis.StartPoint, InstantAxis.EndPoint))); ///<summary>Depending on which of the above 2 angles is smaller the final angle called <see cref="Angle_Bis2_Final_PlaneREDs"/> is assigned</summary> if (Math.Abs(Angle_Bis2_PlaneRED.Degrees) < Math.Abs(Angle_Bis1_PlaneRED.Degrees)) { Angle_Bis2_Final_PlaneREDs = Angle_Bis2_PlaneRED; PlaneToConstructPlaneB = PlaneRED.Clone() as Plane; } else { Angle_Bis2_Final_PlaneREDs = Angle_Bis2_PlaneRED2; PlaneToConstructPlaneB = PlaneRED2.Clone() as Plane; } ///<summary>Rotating the <see cref="PlaneToConstructPlaneB"/> by an amount equal to twice the final angle calculated above</summary> PlaneToConstructPlaneB.Rotate(-Angle_Bis2_Final_PlaneREDs.Radians * 2, new Vector3D(InstantAxis.StartPoint, InstantAxis.EndPoint), InstantAxis.MidPoint); ///<summary>Depending upon the Position of <see cref="PointA"/> the <see cref="SegmentForPointB"/> is decided</summary> if (PointAPos == PositionOfPointA.AboveWishbones) { SegmentForPointB = new Segment3D(LBJ_Rear.Position, ToeLinkupright.Position); } else if (PointAPos == PositionOfPointA.BelowWishbones) { SegmentForPointB = new Segment3D(UBJ_Rear.Position, ToeLinkupright.Position); } ///<summary>Computing the Intersection between the <see cref="SegmentForPointB"/> and the <see cref="PlaneToConstructPlaneB"/> which results in the <see cref="PointB"/></summary> SegmentForPointB.IntersectWith(PlaneToConstructPlaneB, true, out PointB); ///<summary>Depending upon whether the <<see cref="PointA"/> is above or below the Wishbones, the Points to draw <see cref="PlaneB"/> (apart from <see cref="PointB"/>!!!) are chosen</summary> if (PointAPos == PositionOfPointA.AboveWishbones) { PlaneB = new Plane(BottomRearInboard.Position, BottomFrontInboard.Position, PointB); } else if (PointAPos == PositionOfPointA.BelowWishbones) { PlaneB = new Plane(TopRearInboard.Position, TopFrontInboard.Position, PointB); } PlanarEntity PlaneB_Ent = new PlanarEntity(PlaneB); Joint PointB_Ent = new Joint(PointB, 5, 2); PointB_Ent.Color = Color.AntiqueWhite; //cad1.viewportLayout1.Entities.AddRange(new Entity[] { PlaneB_Ent, PointB_Ent }); }