Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of the Face class.
        /// </summary>
        /// <param name="e1">Any edge.</param>
        /// <param name="e2">Any edge.</param>
        /// <param name="e3">Any edge.</param>
        /// <param name="handle">The handle to the face.</param>
        public Face(Edge e1, Edge e2, Edge e3, NavigationFaceWrapper handle)
        {
            ab = e1;
            if (ab.b == e2.a || ab.b == e2.b)
            {
                bc = e2;
                ca = e3;
            }
            else
            {
                bc = e3;
                ca = e2;
            }

            if (ab.b == bc.b)
            {
                bcIsReversed = true;
                caIsReversed = bc.a == ca.b;
            }
            else
            {
                bcIsReversed = false;
                caIsReversed = bc.b == ca.b;
            }

            plane = new Plane(A, B, C);

            this.handle = handle;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the RegisterFaceCommand class.
 /// </summary>
 /// <param name="a">Point a of the triangle.</param>
 /// <param name="b">Point b of the triangle.</param>
 /// <param name="c">Point c of the triangle.</param>
 /// <param name="surface">The target surface.</param>
 /// <param name="handle">The face handle.</param>
 public RegisterFaceCommand(Vector3 a, Vector3 b, Vector3 c,
                            NavigationSurface surface, NavigationFaceWrapper handle)
 {
     this.a       = a;
     this.b       = b;
     this.c       = c;
     this.handle  = handle;
     this.surface = surface;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Unregisters the face with the handle.
 /// </summary>
 /// <param name="handle">The handle to the face.</param>
 public void UnregisterFace(NavigationFaceWrapper handle)
 {
     if (faces.TryGetValue(handle, out var face))
     {
         faces.Remove(handle);
         RemoveFaceUsageFromEdge(face.ab, face);
         RemoveFaceUsageFromEdge(face.bc, face);
         RemoveFaceUsageFromEdge(face.ca, face);
     }
     else
     {
         Debug.LogError("Unknown handle. Ignoring request.");
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Registers a triangle as a face.
        /// </summary>
        /// <param name="a">Point a of the triangle.</param>
        /// <param name="b">Point b of the triangle.</param>
        /// <param name="c">Point c of the triangle.</param>
        /// <param name="handle">The face handle.</param>
        public void RegisterFace(Vector3 a, Vector3 b, Vector3 c, NavigationFaceWrapper handle)
        {
            var aVertex = FindOrCreateVertex(a);
            var bVertex = FindOrCreateVertex(b);
            var cVertex = FindOrCreateVertex(c);

            var aEdge = FindOrCreateEdge(aVertex, bVertex);
            var bEdge = FindOrCreateEdge(bVertex, cVertex);
            var cEdge = FindOrCreateEdge(cVertex, aVertex);

            var face = new Face(aEdge, bEdge, cEdge, handle);

            aEdge.AddUser(face);
            bEdge.AddUser(face);
            cEdge.AddUser(face);
            faces.Add(handle, face);
        }
 /// <summary>
 /// Creates a new instance of the UnregisterFaceCommand class.
 /// </summary>
 /// <param name="handle">The face handle.</param>
 /// <param name="surface">The target surface.</param>
 public UnregisterFaceCommand(NavigationFaceWrapper handle, NavigationSurface surface)
 {
     this.handle  = handle;
     this.surface = surface;
 }