Пример #1
0
        public static void Main(string[] args)
        {
            var point = new Point(1, 2);
            var point2 = point.Clone() as Point;
            point.Move(2, 3);
            point.Print();
            point2.Print();

            var personWithChildren = new PersonWithChildren("John", "Doe");
            Console.WriteLine(personWithChildren.Name);
            personWithChildren.Children.Add(new PersonWithChildren("John", "Little"));
            Console.WriteLine(personWithChildren["John Little"].Name);
        }
Пример #2
0
        protected override ITrimmedCurve GetTransformedProfileCurve(ITrimmedCurve iTrimmedCurve, double param)
        {
            int numPoints = 10000;
            Point[] points = new Point[numPoints + 1];

            double paramZ = StartZ + (EndZ - StartZ) * param;
            Frame profileFrame = Frame.Create(StartPoint + (EndPoint - StartPoint) * param, StartFrame.DirX, StartFrame.DirY);
            Cone profileCone = GetConeAtParameter(paramZ);
            double radius = profileCone.Radius;
            ICollection<IntPoint<SurfaceEvaluation, CurveEvaluation>> intersections = profileCone.IntersectCurve(TangentLine);
            Matrix trans = Matrix.CreateRotation(Axis, intersections.OrderBy(i => Math.Abs(i.Point.Z)).First().EvaluationA.Param.U);
            //		profileCone.Print(Part);

            //		double scale = (radius / A) / Math.Sin(profileCone.HalfAngle);

            for (int j = 0; j <= numPoints; j++) {
                double t = iTrimmedCurve.Bounds.Start + iTrimmedCurve.Bounds.Span * (double) j / numPoints;
                Vector pointVector = iTrimmedCurve.Geometry.Evaluate(t).Point.Vector;
                double angle = -Circle.Create(Frame.Create(Point.Origin, Direction.DirX, Direction.DirY), GearData.PitchRadius).ProjectPoint(pointVector.GetPoint()).Param;
                double distance = (pointVector.Magnitude - A) * radius / A;// *Math.Sin(profileCone.HalfAngle);

                //		points[j] = profileCone.WrapPoint(angle, (distance - A) / Math.Sin(profileCone.HalfAngle));
                points[j] = profileCone.WrapPoint(angle, distance);
            }
            try {
                return CurveSegment.Create(NurbsCurve.CreateThroughPoints(false, points, Accuracy.LinearResolution)).CreateTransformedCopy(trans);
            }
            catch {
                points.Print();
            }

            return null;
        }