GetVertexDistance() public méthode

Check if the vertex is "visible" from the face. The vertex is "over face" if the return value is > Constants.PlaneDistanceTolerance.
public GetVertexDistance ( int v, ConvexFaceInternal f ) : double
v int
f ConvexFaceInternal
Résultat double
Exemple #1
0
        /// <summary>
        /// Check whether the vertex v is beyond the given face. If so, add it to beyondVertices.
        /// </summary>
        /// <param name="face">The face.</param>
        /// <param name="beyondVertices">The beyond vertices.</param>
        /// <param name="v">The v.</param>
        private void IsBeyond(ConvexFaceInternal face, IndexBuffer beyondVertices, int v)
        {
            var distance = MathHelper.GetVertexDistance(v, face);

            if (distance >= PlaneDistanceTolerance)
            {
                if (distance > MaxDistance)
                {
                    // If it's within the tolerance distance, use the lex. larger point
                    if (distance - MaxDistance < PlaneDistanceTolerance)
                    { // todo: why is this LexCompare necessary. Would seem to favor x over y over z (etc.)?
                        if (LexCompare(v, FurthestVertex) > 0)
                        {
                            MaxDistance    = distance;
                            FurthestVertex = v;
                        }
                    }
                    else
                    {
                        MaxDistance    = distance;
                        FurthestVertex = v;
                    }
                }
                beyondVertices.Add(v);
            }
        }
Exemple #2
0
 private void TraverseAffectedFaces(int currentFace)
 {
     TraverseStack.Clear();
     TraverseStack.Push(currentFace);
     AffectedFaceFlags[currentFace] = true;
     while (TraverseStack.Count > 0)
     {
         ConvexFaceInternal convexFaceInternal = FacePool[TraverseStack.Pop()];
         for (int i = 0; i < NumOfDimensions; i++)
         {
             int num = convexFaceInternal.AdjacentFaces[i];
             if (!AffectedFaceFlags[num] && mathHelper.GetVertexDistance(CurrentVertex, FacePool[num]) >= PlaneDistanceTolerance)
             {
                 AffectedFaceBuffer.Add(num);
                 AffectedFaceFlags[num] = true;
                 TraverseStack.Push(num);
             }
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Recursively traverse all the relevant faces.
        /// </summary>
        void TraverseAffectedFaces(ConvexFaceInternal currentFace)
        {
            TraverseStack.Clear();
            TraverseStack.Push(currentFace);
            currentFace.Tag = 1;

            while (TraverseStack.Count > 0)
            {
                var top = TraverseStack.Pop();
                for (int i = 0; i < Dimension; i++)
                {
                    var adjFace = top.AdjacentFaces[i];

                    if (adjFace.Tag == 0 && MathHelper.GetVertexDistance(CurrentVertex, adjFace) >= PlaneDistanceTolerance)
                    {
                        AffectedFaceBuffer.Add(adjFace);
                        adjFace.Tag = 1;
                        TraverseStack.Push(adjFace);
                    }
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Recursively traverse all the relevant faces.
        /// </summary>
        /// <param name="currentFace">The current face.</param>
        private void TraverseAffectedFaces(int currentFace)
        {
            TraverseStack.Clear();
            TraverseStack.Push(currentFace);
            AffectedFaceFlags[currentFace] = true;

            while (TraverseStack.Count > 0)
            {
                var top = FacePool[TraverseStack.Pop()];
                for (var i = 0; i < NumOfDimensions; i++)
                {
                    var adjFace = top.AdjacentFaces[i];

                    if (!AffectedFaceFlags[adjFace] &&
                        MathHelper.GetVertexDistance(CurrentVertex, FacePool[adjFace]) >= PlaneDistanceTolerance)
                    {
                        AffectedFaceBuffer.Add(adjFace);
                        AffectedFaceFlags[adjFace] = true;
                        TraverseStack.Push(adjFace);
                    }
                }
            }
        }