public override void Transform(Matrix4x4 transformationMatrixIn)
        {
            DiameterP2.Transform(transformationMatrixIn);
            StartPoint.Transform(transformationMatrixIn);

            DiameterP1 = GeometricArithmeticModule.ABSMeasure(StartPoint, EndPoint);
            Update();
        }
Example #2
0
        public override void Transform(Matrix4x4 transformationMatrixIn)
        {
            CentrePoint.Transform(transformationMatrixIn);
            StartPoint.Transform(transformationMatrixIn);

            Radius = GeometricArithmeticModule.ABSMeasure(StartPoint, CentrePoint);
            Update();
        }
Example #3
0
        /// <summary>
        /// Create and arc from three points.
        /// </summary>
        /// <param name="centre">The centre of the arc.</param>
        /// <param name="p1">The starting point</param>
        /// <param name="p2">The end point</param>
        public MarkGeometryArc(MarkGeometryPoint centre, MarkGeometryPoint p1, MarkGeometryPoint p2)
        {
            Radius      = GeometricArithmeticModule.ABSMeasure(centre, p1);
            StartAngle  = GeometricArithmeticModule.CalculateAngle(centre, p1);
            EndAngle    = GeometricArithmeticModule.CalculateAngle(centre, p2);
            CentrePoint = centre;

            StartPoint = p1;
            EndPoint   = p2;

            Update();
        }
Example #4
0
        public override void SetExtents()
        {
            Perimeter = 0;

            if (Points.Count > 0)
            {
                Extents.MinX = Double.MaxValue;
                Extents.MaxX = Double.MinValue;

                Extents.MinY = Double.MaxValue;
                Extents.MaxY = Double.MinValue;

                Extents.MinZ = Double.MaxValue;
                Extents.MaxZ = Double.MinValue;

                for (int i = 0; i < Points.Count; i++)
                {
                    Extents.MinX = GeometricArithmeticModule.Min(Extents.MinX, Points[i].X);
                    Extents.MaxX = GeometricArithmeticModule.Max(Extents.MaxX, Points[i].X);

                    Extents.MinY = GeometricArithmeticModule.Min(Extents.MinY, Points[i].Y);
                    Extents.MaxY = GeometricArithmeticModule.Max(Extents.MaxY, Points[i].Y);

                    Extents.MinZ = GeometricArithmeticModule.Min(Extents.MinZ, Points[i].Z);
                    Extents.MaxZ = GeometricArithmeticModule.Max(Extents.MaxZ, Points[i].Z);

                    if (i < Points.Count - 1)
                    {
                        Perimeter += GeometricArithmeticModule.ABSMeasure(Points[i], Points[i + 1]);
                    }
                }
            }
            else
            {
                Extents.MinX = 0;
                Extents.MaxX = 0;

                Extents.MinY = 0;
                Extents.MaxY = 0;

                Extents.MinZ = 0;
                Extents.MaxZ = 0;
            }
        }
Example #5
0
        public MSTLSlice(List <MContourStructure> contours)
            : this()
        {
            NumberOfContours = contours.Count;

            MarkGeometryPoint lastPoint = null;

            foreach (var contourStructure in contours)
            {
                var(lines, minLineLength, perimeter) = GeometricArithmeticModule.GetLinesAndStatistics(
                    contourStructure.ToPoints()
                    );

                ContourLines.AddRange(
                    lines
                    );

                if (minLineLength < MinVectorLength)
                {
                    MinVectorLength = minLineLength;
                }

                _totalContourMarkDistance += perimeter;
                NumberOfJoints            += (lines.Count - 1);

                if (lines.Count > 0)
                {
                    if (lastPoint != null)
                    {
                        // measure and track the jump distance between the last contour and this
                        _totalContourJumpDistance += GeometricArithmeticModule.ABSMeasure(lastPoint, lines[0].StartPoint);
                    }

                    lastPoint = lines[0].StartPoint;
                }
            }

            _contourQuadTree = new ContourQuadTree(ContourLines);
            Extents          = GeometricArithmeticModule.CalculateExtents(ContourLines);
        }
Example #6
0
        /// <summary>
        /// see: http://www.lee-mac.com/bulgeconversion.html
        /// The curvature of a Polyline Arc segment is defined using a quantity known as bulge.
        /// This unit measures the deviation of the curve from the straight line (chord) joining the two vertices of the segment.
        /// It is defined as the ratio of the arc sagitta (versine) to half the length of
        /// the chord between the two vertices; this ratio is equal to the tangent of a
        /// quarter of the included arc angle between the two polyline vertices.
        /// </summary>
        /// <param name="startPoint"></param>
        /// <param name="endPoint"></param>
        /// <param name="bulge"></param>
        public MarkGeometryArc(MarkGeometryPoint startPoint, MarkGeometryPoint endPoint, double bulge)
        {
            var d  = GeometricArithmeticModule.ABSMeasure(startPoint, endPoint) / 2d;
            var r  = (d * ((Math.Pow(bulge, 2)) + 1)) / (2 * bulge);
            var th = GeometricArithmeticModule.CalculateAngle(startPoint, endPoint) + Math.Acos(d / r);

            Radius      = Math.Abs(r);
            CentrePoint = MarkGeometryPoint.FromPolar(startPoint, th, r);

            if (bulge < 0)
            {
                StartAngle = GeometricArithmeticModule.CalculateAngle(CentrePoint, endPoint);
                EndAngle   = GeometricArithmeticModule.CalculateAngle(CentrePoint, startPoint);
            }
            else
            {
                StartAngle = GeometricArithmeticModule.CalculateAngle(CentrePoint, startPoint);
                EndAngle   = GeometricArithmeticModule.CalculateAngle(CentrePoint, endPoint);
            }

            Update();
        }