Example #1
0
        }                                         // pointer to e1 (forward) and e2 (backward) edges

        public static LinkedList <IntersectionStructure> Create(MVertex intersectionPoint, STLEdge forwardEdge, STLEdge backwardEdge)
        {
            var iis = new LinkedList <IntersectionStructure>();

            iis.AddLast(
                new IntersectionStructure()
            {
                ForwardEdgeIntersectionPoint = intersectionPoint,
                ForwardEdge  = forwardEdge,
                BackwardEdge = backwardEdge
            }
                );

            return(iis);
        }
Example #2
0
        public STLFacet(double[] normalsIn, double[] v0, double[] v1, double[] v2)
        {
            Normals = new STLNormals(normalsIn);

            // sort input by their z positions
            // but retain their counter-clockwise order using Flags

            if (v0[2] >= v1[2] && v0[2] >= v2[2]) // v0 is greater
            {
                Vmax = new STLVertex(v0)
                {
                    Flag = 0
                };

                if (v1[2] <= v2[2]) // v1 is lesser
                {
                    Vmin = new STLVertex(v1)
                    {
                        Flag = 1
                    };

                    Vmid = new STLVertex(v2)
                    {
                        Flag = 2
                    };

                    OrientationType = OrientationType.TypeC;
                }
                else
                {
                    Vmid = new STLVertex(v1)
                    {
                        Flag = 1
                    };

                    Vmin = new STLVertex(v2)
                    {
                        Flag = 2
                    };

                    OrientationType = OrientationType.TypeB;
                }
            }
            else if (v1[2] >= v0[2] && v1[2] >= v2[2]) // v1 is greater
            {
                Vmax = new STLVertex(v1)
                {
                    Flag = 1
                };

                if (v0[2] <= v2[2]) // v0 is lesser
                {
                    Vmin = new STLVertex(v0)
                    {
                        Flag = 0
                    };

                    Vmid = new STLVertex(v2)
                    {
                        Flag = 2
                    };

                    OrientationType = OrientationType.TypeA;
                }
                else
                {
                    Vmid = new STLVertex(v0)
                    {
                        Flag = 0
                    };

                    Vmin = new STLVertex(v2)
                    {
                        Flag = 2
                    };

                    OrientationType = OrientationType.TypeC;
                }
            }
            else if (v2[2] >= v0[2] && v2[2] >= v1[2]) // v2 is greater
            {
                Vmax = new STLVertex(v2)
                {
                    Flag = 2
                };

                if (v0[2] <= v1[2]) // v0 is lesser
                {
                    Vmin = new STLVertex(v0)
                    {
                        Flag = 0
                    };

                    Vmid = new STLVertex(v1)
                    {
                        Flag = 1
                    };

                    OrientationType = OrientationType.TypeD;
                }
                else
                {
                    Vmid = new STLVertex(v0)
                    {
                        Flag = 0
                    };

                    Vmin = new STLVertex(v1)
                    {
                        Flag = 1
                    };

                    OrientationType = OrientationType.TypeA;
                }
            }

            EdgeS1 = new STLEdge
            {
                Start = Vmin,
                End   = Vmax
            };

            EdgeS2 = new STLEdge
            {
                Start = Vmin,
                End   = Vmid
            };

            EdgeS3 = new STLEdge
            {
                Start = Vmid,
                End   = Vmax
            };
        }