CSharpGL.IPickableHelper.GetLastVertexIdOfPickedGeometry C# (CSharp) Method

GetLastVertexIdOfPickedGeometry() public static method

Returns last vertex's id of picked geometry if the geometry represented by stageVertexId belongs to this element instance.

Returns false if stageVertexId the primitive is in some other element.

public static GetLastVertexIdOfPickedGeometry ( this element, uint stageVertexId, uint &lastVertexId ) : bool
element this
stageVertexId uint
lastVertexId uint
return bool
        public static bool GetLastVertexIdOfPickedGeometry(this IPickable element,
            uint stageVertexId, out uint lastVertexId)
        {
            lastVertexId = uint.MaxValue;
            bool result = false;

            if (element != null)
            {
                if (stageVertexId < element.PickingBaseId) // ID is in some previous element.
                { return false; }

                uint vertexCount = element.GetVertexCount();
                uint id = stageVertexId - element.PickingBaseId;
                if (id < vertexCount)
                {
                    lastVertexId = id;
                    result = true;
                }
                else // ID is in some subsequent element.
                {
                    result = false;
                }
            }

            return result;
        }