/// <summary> /// Method to construct the Bisector 2 /// </summary> private void ConstructBisector2() { ///<summary>Drawing the Line of the <see cref="PlaneSTEERING"/></summary> Line LineForAngle_PlaneSTEERING = new Line(InstantAxis.MidPoint.Clone() as Point3D, ToeLinkupright.Position.Clone() as Point3D); ///<summary>Drawing the Line of the Wishbone Plane depending upon the <see cref="LinkagePair"/></summary> Line LineForAngle_PlaneWISHBONE = new Line(0, 0, 0, 1, 1, 1); if (LinkagePair == BobillierPair.BottomWishboneAndSteering) { LineForAngle_PlaneWISHBONE = new Line(InstantAxis.MidPoint.Clone() as Point3D, LBJ_Rear.Position.Clone() as Point3D); } else if (LinkagePair == BobillierPair.TopWishboneAndSteering) { LineForAngle_PlaneWISHBONE = new Line(InstantAxis.MidPoint.Clone() as Point3D, UBJ_Rear.Position.Clone() as Point3D); } ///<summary>Finding the Angle of the Steering Plane with the selected Wishbone Plane </summary> Angle Angle_PlaneSTEERING_PlaneWISHBONE = SetupChangeDatabase.AngleInRequiredView(_vAngleOfThis: Custom3DGeometry.GetMathNetVector3D(LineForAngle_PlaneSTEERING), _vAngleWithThis: Custom3DGeometry.GetMathNetVector3D(LineForAngle_PlaneWISHBONE), _vNormalToViewPlane: Custom3DGeometry.GetMathNetVector3D(new Line(InstantAxis.StartPoint, InstantAxis.EndPoint))); //Angle_PlaneSTEERING_PlaneWISHBONE = AssignAngleSignBasedOnVectorDirection(Angle_PlaneSTEERING_PlaneWISHBONE, Custom3DGeometry.GetMathNetVector3D(new Line(ICLine.StartPoint, ICLine.EndPoint))); ///<summary>Creating a Bisector Line</summary> Bisector2 = LineForAngle_PlaneWISHBONE.Clone() as Line; Bisector2.Rotate(angleInRadians: Angle_PlaneSTEERING_PlaneWISHBONE.Radians / 2, axis: new Vector3D(InstantAxis.StartPoint.Clone() as Point3D, InstantAxis.EndPoint.Clone() as Point3D), center: InstantAxis.MidPoint); //cad1.viewportLayout1.Entities.Add(Bisector2); }
/// <summary> /// <para>Method to get the Angle between the Last and 2nd Last position of the Upright</para> /// <para>At the end of the this method, the Upright is returned to its 2nd last position. This is because, in this method I cam literally stretching the Upright to a position defined by the <paramref name="_shimsOrLinkLine"/>'s End Point. This is not True. In actuality the Upright is /// rotated when the <paramref name="_shimsOrLinkLine"/> is increase/decreased. So the Upright needs to be Rotated by the angle calculated and then the <paramref name="_shimsOrLinkLine"/>'s End Point shoud be set using /// <see cref="GetLinkLengthChangeFromUprightAngle(List{Line}, SetupChangeDatabase, CurrentChange, AdjustmentTools)"/> and an iterative loop should be formed until the <paramref name="_shimsOrLinkLine"/> is of length which the user wants</para> /// </summary> /// <param name="_upright">List of Upright Triangles belonging to <see cref="SetupChangeDatabase"/> with UBJ[0] LBJ[1] and ToeLink[2] </param> /// <param name="_vertex1">This could be any of the other 3 points. Remeber UBJ[0] LBJ[1] and ToeLink[2] while passing c</param> /// <param name="_vertex2">This could be any of the other 3 points. Remeber UBJ[0] LBJ[1] and ToeLink[2] while passing </param> /// <param name="_vertex3">This could be any of the other 3 points. Remeber UBJ[0] LBJ[1] and ToeLink[2] while passing</param> /// <param name="_scd"></param> /// <returns></returns> public Angle GetNewUprightTrianglePosition(ref List <Triangle> _upright, Point3D _vertex1, Point3D _vertex2, Point3D _vertex3, SetupChangeDatabase _scd, Line _axisOfRotation) { Angle rotatedAngle = new Angle(0, AngleUnit.Radians); _upright.Add(new Triangle(new Point3D(_vertex1.X, _vertex1.Y, _vertex1.Z), new Point3D(_vertex2.X, _vertex2.Y, _vertex2.Z), new Point3D(_vertex3.X, _vertex3.Y, _vertex3.Z))); for (int i = 0; i < _upright.Count; i++) { _upright[i].Regen(0); } rotatedAngle = SetupChangeDatabase.AngleInRequiredView(new MathNet.Spatial.Euclidean.Vector3D(_upright[_upright.Count - 1].Normal.X, _upright[_upright.Count - 1].Normal.Y, _upright[_upright.Count - 1].Normal.Z), new MathNet.Spatial.Euclidean.Vector3D(_upright[_upright.Count - 2].Normal.X, _upright[_upright.Count - 2].Normal.Y, _upright[_upright.Count - 2].Normal.Z), Custom3DGeometry.GetMathNetVector3D(_scd.WheelCentreAxis.Longitudinal)); //rotatedAngle = SetupChangeDatabase.AngleInRequiredView(new MathNet.Spatial.Euclidean.Vector3D(_upright[_upright.Count - 1].Normal.X, _upright[_upright.Count - 1].Normal.Y, _upright[_upright.Count - 1].Normal.Z), // new MathNet.Spatial.Euclidean.Vector3D(_upright[_upright.Count - 2].Normal.X, _upright[_upright.Count - 2].Normal.Y, _upright[_upright.Count - 2].Normal.Z), // Custom3DGeometry.GetMathNetVector3D(_scd.WheelCentreAxis.Vertical)); rotatedAngle = SetupChangeDatabase.AngleInRequiredView(new MathNet.Spatial.Euclidean.Vector3D(_upright[_upright.Count - 1].Normal.X, _upright[_upright.Count - 1].Normal.Y, _upright[_upright.Count - 1].Normal.Z), new MathNet.Spatial.Euclidean.Vector3D(_upright[_upright.Count - 2].Normal.X, _upright[_upright.Count - 2].Normal.Y, _upright[_upright.Count - 2].Normal.Z), Custom3DGeometry.GetMathNetVector3D(/*_scd.LBJToToeLink.Line.DeltaLine[_scd.LBJToToeLink.Line.DeltaLine.Count - 1]*/ _axisOfRotation)); ///<summary>Reverting the Upright to its original state so it can rotated and brought to the right state</summary> _upright[_upright.Count - 1] = (new Triangle(new Point3D(_upright[_upright.Count - 2].Vertices[0].X, _upright[_upright.Count - 2].Vertices[0].Y, _upright[_upright.Count - 2].Vertices[0].Z), new Point3D(_upright[_upright.Count - 2].Vertices[1].X, _upright[_upright.Count - 2].Vertices[1].Y, _upright[_upright.Count - 2].Vertices[1].Z), new Point3D(_upright[_upright.Count - 2].Vertices[2].X, _upright[_upright.Count - 2].Vertices[2].Y, _upright[_upright.Count - 2].Vertices[2].Z))); return(rotatedAngle); }
/// <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 }); }
public void LinkLengthChanged(double _dLinkLength, Plane _linksPlane, List <Line> _link, List <Vector3D> _linnkVector, List <Line> _counterLink, SetupChangeDatabase _scd, SolverMasterClass _smc) { AddAdjusterToMasterAdjusterList(_link, _linnkVector); Custom3DGeometry _counter = new Custom3DGeometry(new Point3D(_counterLink[_counterLink.Count - 1].StartPoint.X, _counterLink[_counterLink.Count - 1].StartPoint.Y, _counterLink[_counterLink.Count - 1].StartPoint.Z), new Point3D(_counterLink[_counterLink.Count - 1].EndPoint.X, _counterLink[_counterLink.Count - 1].EndPoint.Y, _counterLink[_counterLink.Count - 1].EndPoint.Z)); Angle FV = SetupChangeDatabase.AngleInRequiredView(Custom3DGeometry.GetMathNetVector3D(_counter.ViewLines.FrontView.DeltaLine[_counter.ViewLines.FrontView.DeltaLine.Count - 1]), Custom3DGeometry.GetMathNetVector3D(_scd.WheelCentreAxis.Vertical), Custom3DGeometry.GetMathNetVector3D(_scd.WheelCentreAxis.Longitudinal)); FV = new Angle(90 + FV.Degrees, AngleUnit.Degrees); _counter.PerpAlongY.Aft.Translate(_counterLink[_counterLink.Count - 1].MidPoint.X - _counterLink[_counterLink.Count - 1].StartPoint.X, _counterLink[_counterLink.Count - 1].MidPoint.Y - _counterLink[_counterLink.Count - 1].StartPoint.Y, _counterLink[_counterLink.Count - 1].MidPoint.Z - _counterLink[_counterLink.Count - 1].StartPoint.Z); Triangle SV = new Triangle(_link[_link.Count - 1].StartPoint, _link[_link.Count - 1].EndPoint, _counterLink[_counterLink.Count - 1].StartPoint); SV.Regen(0); Angle test = SetupChangeDatabase.AngleInRequiredView(Custom3DGeometry.GetMathNetVector3D(_counter.PerpAlongY.Aft), new MathNet.Spatial.Euclidean.Vector3D(SV.Normal.X, SV.Normal.Y, SV.Normal.Z), Custom3DGeometry.GetMathNetVector3D(_scd.WheelCentreAxis.Lateral)); _counter.PerpAlongY.Aft.Rotate(FV.Radians, Custom3DGeometry.GetdevDeptVector3D(_scd.WheelCentreAxis.Longitudinal)); _counter.PerpAlongY.Aft.Rotate(test.Radians, Custom3DGeometry.GetdevDeptVector3D(_scd.WheelCentreAxis.Lateral)); Angle testAngleRotatate = new Angle(_dLinkLength / _counterLink[_counterLink.Count - 1].Length(), AngleUnit.Radians); Start: _counterLink[_counterLink.Count - 1].Rotate(testAngleRotatate.Radians, Custom3DGeometry.GetdevDeptVector3D(_counter.PerpAlongY.Aft)); _link[_link.Count - 1].EndPoint.X = _counterLink[_counterLink.Count - 1].EndPoint.X; _link[_link.Count - 1].EndPoint.Y = _counterLink[_counterLink.Count - 1].EndPoint.Y; _link[_link.Count - 1].EndPoint.Z = _counterLink[_counterLink.Count - 1].EndPoint.Z; double staticLength = _link[0].Length(); double newLenggth = _link[_link.Count - 1].Length(); double checker = _dLinkLength - (_link[_link.Count - 1].Length() - _link[0].Length()); if (Math.Abs(checker) > 0.5) { AddAdjusterToMasterAdjusterList(_link, _linnkVector); double testCounter = _counterLink[_counterLink.Count - 1].Length(); testAngleRotatate = new Angle((checker / _counterLink[_counterLink.Count - 1].Length()), AngleUnit.Radians); goto Start; } }
/// <summary> /// Method to construct the <see cref="Bisector1"/> /// </summary> private void ConstructBisector1() { ///<summary>Creating 2 temporay Lines to represent the Top and Bottom Wishbones. Need this to find the angle between the Top and Bottom Wishbone Planes</summary> Line LineForAngle_TopWishbone = new Line(InstantAxis.MidPoint.Clone() as Point3D, UBJ_Rear.Position.Clone() as Point3D); Line LineForAngle_BottomWishbone = new Line(InstantAxis.MidPoint.Clone() as Point3D, LBJ_Rear.Position.Clone() as Point3D); ///<summary>Calculating the Line between the Top and Bottom Wishbone Planes by calculating the angle between the Lines created above</summary> Angle angle = (SetupChangeDatabase.AngleInRequiredView(Custom3DGeometry.GetMathNetVector3D(new Line(InstantAxis.MidPoint, UBJ_Rear.Position)), Custom3DGeometry.GetMathNetVector3D(new Line(InstantAxis.MidPoint, LBJ_Rear.Position)), Custom3DGeometry.GetMathNetVector3D(new Line(InstantAxis.StartPoint, InstantAxis.EndPoint)))); ///<summary>Drawing a line alonge the LBJ Line </summary> Bisector1 = new Line(InstantAxis.MidPoint.Clone() as Point3D, LBJ_Rear.Position.Clone() as Point3D); ///<summary>Rotating the Bisector Line by twice the amount of half the angle of the angle between the Top and Bottom Wishbone Planes</summary> Bisector1.Rotate(angle.Radians / 2, new Vector3D(InstantAxis.StartPoint.Clone() as Point3D, InstantAxis.EndPoint.Clone() as Point3D), InstantAxis.MidPoint); //cad1.viewportLayout1.Entities.Add(Bisector1); }
//private void InitUprightBasedOnAdjustmentTool(Dictionary<string, AdjustmentTools> _adjToolDictionary, SetupChangeDatabase _scd) //{ // if (_adjToolDictionary["CamberChange"] == AdjustmentTools.TopCamberMount) // { // GetNewUprightTrianglePosition(ref _scd.UprightTriangle, TopCamberShimsLine[TopCamberShimsLine.Count - 1].EndPoint, _scd.LBJ, _scd.ToeLinkUpright, _scd); // } // else if (_adjToolDictionary["CamberChange"] == AdjustmentTools. BottomCamberMount) // { // } //} /// <summary> /// Method to get a Vector and Line which represent the group of Shims.These maybe camber shims at the Camber Mount or Link Shims at the Wishbone Arms (or Toe Link) Obtained by drawing a line at the UBJ or LBJ on the Wishbone Plane and then making it parallel in the /// Top View with the Wheel Spindle /// </summary> /// <param name="_scmPlane"></param> /// <param name="_scd"></param> /// <param name="_camberShimsLine"></param> /// <param name="_camberShimsVector"></param> /// <param name="_wishbonePlane"></param> /// <param name="_UBJorLBJ"></param> private void InitializeShimsGeometry(SuspensionCoordinatesMaster _scmPlane, SetupChangeDatabase _scd, List <Line> _camberShimsLine, List <Vector3D> _camberShimsVector, Plane _wishbonePlane, Point3D _UBJorLBJ) { ///<summary>Creating a temp line to represent the Camber Shims Line and will added to the <see cref="BottomCamberShimsLine"/> OR <see cref="TopCamberShimsLine"/></summary> ///<remarks> ///COordinate are passed as (0,0) and (5,0). This is becase the <see cref="TopWishbonePlane"/> and <see cref="BottomWishbonePlane"/> have the UBJ and LBJ as their origins. ///Hence, you need to pass 0,0 and 5,0 so that the Camber Line starts at UBJ and extends by 5 in X direction ///</remarks> Line _tempCamberShimsLine = new Line(_wishbonePlane, /*_UBJorLBJ.X*/ 0, /*_UBJorLBJ.Z*/ 0, /*_UBJorLBJ.X + */ 5, /*_UBJorLBJ.Z*/ 0); Angle angle = SetupChangeDatabase.AngleInRequiredView(Custom3DGeometry.GetMathNetVector3D(new Line(_tempCamberShimsLine.StartPoint.X, 0, _tempCamberShimsLine.StartPoint.Z, _tempCamberShimsLine.EndPoint.X, 0, _tempCamberShimsLine.EndPoint.Z)), Custom3DGeometry.GetMathNetVector3D(new Line(_scd.WheelSpindle.Line.DeltaLine[0].StartPoint.X, 0, _scd.WheelSpindle.Line.DeltaLine[0].StartPoint.Z, _scd.WheelSpindle.Line.DeltaLine[0].EndPoint.X, 0, _scd.WheelSpindle.Line.DeltaLine[0].EndPoint.Z)), Custom3DGeometry.GetMathNetVector3D(_scd.WheelCentreAxis.Vertical)); _tempCamberShimsLine.Rotate(-angle.Radians, _tempCamberShimsLine.StartPoint, new Point3D(_tempCamberShimsLine.StartPoint.X, _tempCamberShimsLine.StartPoint.Y + 100, _tempCamberShimsLine.StartPoint.Z)); _camberShimsLine.Add(_tempCamberShimsLine); _camberShimsVector.Add(new Vector3D(new Point3D(_tempCamberShimsLine.StartPoint.X, _tempCamberShimsLine.StartPoint.Y, _tempCamberShimsLine.StartPoint.Z), new Point3D(_tempCamberShimsLine.EndPoint.X, _tempCamberShimsLine.EndPoint.Y, _tempCamberShimsLine.EndPoint.Z))); }
/// <summary> /// Method to construct the <see cref="PlaneRED"/> and the <see cref="PlaneRED2"/> /// </summary> private void ConstructPlaneREDs() { ///<summary>Constructing the <see cref="PlaneRED"/> using the <see cref="InstantAxis"/> and the <see cref="PointA"/></summary> PlaneRED = new Plane(InstantAxis.StartPoint.Clone() as Point3D, InstantAxis.EndPoint.Clone() as Point3D, PointA.Clone() as Point3D); ///<summary>Constructing the Line of the <see cref=PlaneRED"/> needed for the angle</summary> LineForAngle_PlaneRED = new Line(InstantAxis.MidPoint.Clone() as Point3D, PointA.Clone() as Point3D); ///<summary>Computing the <see cref="Angle"/> between the <see cref="PlaneRED"/> and the <see cref="Bisector1"/></summary> Angle_Bis1_PlaneRED = SetupChangeDatabase.AngleInRequiredView(Custom3DGeometry.GetMathNetVector3D(LineForAngle_PlaneRED), Custom3DGeometry.GetMathNetVector3D(Bisector1), Custom3DGeometry.GetMathNetVector3D(new Line(InstantAxis.StartPoint, InstantAxis.EndPoint))); ///<summary>Cloning <see cref="PlaneRED"/> onto <see cref="PlaneRED2"/> and creating its line</summary> PlaneRED2 = PlaneRED.Clone() as Plane; LineForAngle_PlaneRed2 = LineForAngle_PlaneRED.Clone() as Line; ///<summary>Rotating the <see cref="PlaneRED2"/> and its <see cref="LineForAngle_PlaneRed2"/> by an amount equal to twice the Angle b/w <see cref="Bisector1"/> and <see cref="PlaneRED"/></summary> PlaneRED2.Rotate(-Angle_Bis1_PlaneRED.Radians * 2, new Vector3D(InstantAxis.StartPoint.Clone() as Point3D, InstantAxis.EndPoint.Clone() as Point3D), InstantAxis.MidPoint); LineForAngle_PlaneRed2.Rotate(-Angle_Bis1_PlaneRED.Radians * 2, new Vector3D(InstantAxis.StartPoint.Clone() as Point3D, InstantAxis.EndPoint.Clone() as Point3D), InstantAxis.StartPoint); PlanarEntity PlaneRED_Ent = new PlanarEntity(PlaneRED); PlanarEntity PlaneRED2_Ent = new PlanarEntity(PlaneRED2); //cad1.viewportLayout1.Entities.AddRange(new Entity[] { PlaneRED_Ent, PlaneRED2_Ent }); }