Exemple #1
0
        private List <Edge> IntersectedEdges(Vector2 edgeStart, SliceHierarchy father, Vector2 edgeEnd)
        {
            var interEdges = new List <Edge>();

            for (var p = father.Points.First; p != null; p = p.Next)
            {
                if (p.Value.v2.Equals(edgeStart))
                {
                    continue;
                }

                var areIntersect = WholeSlicePlane.LineSegmentsIntersection(
                    edgeStart,
                    edgeEnd,
                    p.Value.v2,
                    LinkedListExtensions.Next(p).Value.v2, out var interPoint);

                //intersection point with father(outer) points
                if (areIntersect)
                {
                    var point = p.Value.v2.x > LinkedListExtensions.Next(p).Value.v2.x ? p : LinkedListExtensions.Next(p);

                    var edge = new Edge {
                        FDiscret = p, SDiscret = LinkedListExtensions.Next(p), MaxXdiscret = point, Inter = interPoint
                    };
                    interEdges.Add(edge);
                }
            }

            return(interEdges);
        }
Exemple #2
0
        public Intersector(Vector3 planePoint,
                           Vector3 planeNormal, GameObject srcObject, Mesh mesh)
        {
            _planeNormal     = planeNormal;
            _planePoint      = planePoint;
            _srcObject       = srcObject;
            _wholeSlicePlane = new WholeSlicePlane(srcObject.transform.InverseTransformPoint(planeNormal));

            _verts     = new List <Vector3>();
            _normals   = new List <Vector3>();
            _uvs       = new List <Vector2>();
            _triangles = new List <int>();
            _tangents  = new List <Vector4>();
        }