public virtual ICollection <ITrimmedCurve> GetProfile() { baseRadius = Data.BaseRadius; pitchRadius = Data.PitchRadius; addendumRadius = Data.AddendumRadius; dedendumRadius = Data.DedendumRadius; basicInvolute = CurveSegment.Create(Data.CreateInvolute()); offsetAngle = Data.OffsetAngle; involutePitchTrans = Matrix.CreateRotation(Line.Create(Point.Origin, Direction.DirZ), offsetAngle); curveA = basicInvolute.CreateTransformedCopy(involutePitchTrans); curveB = curveA.CreateTransformedCopy(mirror); if (Data.TopStartAngle < Data.TopEndAngle) { topCurve = CurveSegment.Create(Data.AddendumCircle, Interval.Create(Data.TopStartAngle, Data.TopEndAngle)); period.Add(topCurve); } else // involutes intersect at top land { ICollection <IntPoint <CurveEvaluation, CurveEvaluation> > intersections = curveA.IntersectCurve(curveB.CreateTransformedCopy(Data.ToothTrans)); Debug.Assert(intersections.Count == 1); if (intersections.Count != 1) { curveA.Print(); curveB.CreateTransformedCopy(Data.ToothTrans).Print(); } curveA = CurveSegment.Create(curveA.Geometry, Interval.Create(curveA.Bounds.Start, intersections.First().EvaluationA.Param)); curveB = curveA.CreateTransformedCopy(mirror); } ICollection <IntPoint <CurveEvaluation, CurveEvaluation> > bottomIntersections = curveA.IntersectCurve(curveB); if (bottomIntersections.Count > 0 && bottomIntersections.First().Point.Vector.Magnitude > dedendumRadius) // the involutes intersect at bottom land { curveA = CurveSegment.Create(curveA.Geometry, Interval.Create(curveA.IntersectCurve(curveB).ToArray()[0].EvaluationA.Param, curveA.Bounds.End)); period.Add(curveA); period.Add(curveA.CreateTransformedCopy(mirror)); return(period); } return(null); }
public virtual ICollection<ITrimmedCurve> GetProfile() { baseRadius = Data.BaseRadius; pitchRadius = Data.PitchRadius; addendumRadius = Data.AddendumRadius; dedendumRadius = Data.DedendumRadius; basicInvolute = CurveSegment.Create(Data.CreateInvolute()); offsetAngle = Data.OffsetAngle; involutePitchTrans = Matrix.CreateRotation(Line.Create(Point.Origin, Direction.DirZ), offsetAngle); curveA = basicInvolute.CreateTransformedCopy(involutePitchTrans); curveB = curveA.CreateTransformedCopy(mirror); if (Data.TopStartAngle < Data.TopEndAngle) { topCurve = CurveSegment.Create(Data.AddendumCircle, Interval.Create(Data.TopStartAngle, Data.TopEndAngle)); period.Add(topCurve); } else { // involutes intersect at top land ICollection<IntPoint<CurveEvaluation, CurveEvaluation>> intersections = curveA.IntersectCurve(curveB.CreateTransformedCopy(Data.ToothTrans)); Debug.Assert(intersections.Count == 1); if (intersections.Count != 1) { curveA.Print(); curveB.CreateTransformedCopy(Data.ToothTrans).Print(); } curveA = CurveSegment.Create(curveA.Geometry, Interval.Create(curveA.Bounds.Start, intersections.First().EvaluationA.Param)); curveB = curveA.CreateTransformedCopy(mirror); } ICollection<IntPoint<CurveEvaluation, CurveEvaluation>> bottomIntersections = curveA.IntersectCurve(curveB); if (bottomIntersections.Count > 0 && bottomIntersections.First().Point.Vector.Magnitude > dedendumRadius) { // the involutes intersect at bottom land curveA = CurveSegment.Create(curveA.Geometry, Interval.Create(curveA.IntersectCurve(curveB).ToArray()[0].EvaluationA.Param, curveA.Bounds.End)); period.Add(curveA); period.Add(curveA.CreateTransformedCopy(mirror)); return period; } return null; }
public override ICollection <ITrimmedCurve> GetProfile() { IPart iPart = Window.ActiveWindow.Scene as Part; if (base.GetProfile() != null) { return(period); } CurveSegment trochoidA = CurveSegment.Create(Data.CreateConjugateTrochoid(ConjugateGearData)); ICollection <IntPoint <CurveEvaluation, CurveEvaluation> > intersectionsInvolute = trochoidA.IntersectCurve(curveA); CurveSegment addendumCircle = null; Matrix conjugateTrans = Matrix.CreateTranslation(Vector.Create(Data.PitchRadius + ConjugateGearData.PitchRadius, 0, 0)); // involute traced by only one corner // addendumCircle = CurveSegment.Create(ConjugateGearData.AddendumCircle).CreateTransformedCopy(conjugateTrans); // ClosestSeparation extension technique, with scaling Circle largeCircle = Circle.Create(Frame.Create(conjugateTrans * Point.Origin, Direction.DirX, Direction.DirY), ConjugateGearData.PitchRadius + pitchRadius); Separation separation = CurveSegment.Create(largeCircle).GetClosestSeparation(trochoidA); Circle circle = Circle.Create(largeCircle.Frame, (separation.PointB - largeCircle.Frame.Origin).Magnitude - Accuracy.LinearResolution * 100); addendumCircle = CurveSegment.Create(circle); //// Three point circle techique //Matrix rotation = Matrix.CreateRotation(Line.Create(conjugateTrans * Point.Origin, Direction.DirZ), 2 * Math.PI / 3); //double param = trochoidA.Geometry.Parameterization.Range.Value.GetParameter(0.5); //CurveSegment curve0 = trochoidA.CreateTransformedCopy(Matrix.Identity); //CurveSegment curve1 = curve0.CreateTransformedCopy(rotation); //CurveSegment curve2 = curve1.CreateTransformedCopy(rotation); //Circle circle = Circle.CreateTangentToThree( // Plane.PlaneXY, // new CurveParam(curve0.Geometry, param), // new CurveParam(curve1.Geometry, param), // new CurveParam(curve2.Geometry, param) //); // addendumCircle = CurveSegment.Create(Circle.Create(Frame.Create(circle.Frame.Origin, Direction.DirX, Direction.DirY), circle.Radius - Accuracy.LinearResolution * 10)); if (intersectionsInvolute.Count == 0) // error { DesignCurve.Create(iPart, CurveSegment.Create(addendumCircle.Geometry)); DesignCurve.Create(iPart, trochoidA); DesignCurve.Create(iPart, trochoidA.CreateTransformedCopy(mirror)); DesignCurve.Create(iPart, curveA); DesignCurve.Create(iPart, curveA.CreateTransformedCopy(mirror)); return(null); } /// else { IntPoint <CurveEvaluation, CurveEvaluation> intersectionInvolute = intersectionsInvolute.ToArray()[0]; addendumCircle = addendumCircle.CreateTransformedCopy(Matrix.CreateScale(1 / 1.00, (addendumCircle.Geometry as Circle).Frame.Origin)); double maxDist = 0; ICollection <IntPoint <CurveEvaluation, CurveEvaluation> > intersections = trochoidA.IntersectCurve(addendumCircle); if (intersections.Count == 0) { trochoidA.Print(); trochoidA.CreateTransformedCopy(mirror).Print(); addendumCircle.Print(); curveA.Print(); curveA.CreateTransformedCopy(mirror).Print(); } IntPoint <CurveEvaluation, CurveEvaluation> intersectionOther = intersections.First(); foreach (IntPoint <CurveEvaluation, CurveEvaluation> intersection in intersections) { double dist = Math.Abs(intersection.EvaluationA.Param - intersectionInvolute.EvaluationA.Param); if (dist > maxDist) { intersectionOther = intersection; maxDist = dist; } } // period.Add(addendumCircle); if (maxDist == 0) //error { DesignCurve.Create(iPart, CurveSegment.Create(addendumCircle.Geometry)); DesignCurve.Create(iPart, trochoidA); DesignCurve.Create(iPart, trochoidA.CreateTransformedCopy(mirror)); DesignCurve.Create(iPart, curveA); DesignCurve.Create(iPart, curveA.CreateTransformedCopy(mirror)); return(null); } period.Add(CurveSegment.Create(addendumCircle.Geometry, Interval.Create(intersectionOther.EvaluationB.Param, 2 * Math.PI - intersectionOther.EvaluationB.Param))); // } //CurveSegment trochoidB = trochoidA.CreateTransformedCopy(mirror); //intersectionOther = trochoidA.IntersectCurve(trochoidB).ToArray()[0]; trochoidA = CurveSegment.Create(trochoidA.Geometry, Interval.Create(intersectionOther.EvaluationA.Param, intersectionInvolute.EvaluationA.Param)); period.Add(trochoidA); period.Add(trochoidA.CreateTransformedCopy(mirror)); curveA = CurveSegment.Create(curveA.Geometry, Interval.Create(intersectionInvolute.EvaluationB.Param, curveA.Bounds.End)); period.Add(curveA); period.Add(curveA.CreateTransformedCopy(mirror)); return(period); }