public override void GetPointByVal(int index, com.epl.geometry.Point dst)
 {
     if (index < 0 || index >= m_pointCount)
     {
         // TODO
         throw new com.epl.geometry.GeometryException("index out of bounds");
     }
     // _ASSERT(!IsEmpty());
     // _ASSERT(m_vertexAttributes != null);
     _verifyAllStreams();
     com.epl.geometry.Point outPoint = dst;
     outPoint.AssignVertexDescription(m_description);
     if (outPoint.IsEmpty())
     {
         outPoint._setToDefault();
     }
     for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
     {
         // fix semantics
         int semantics = m_description._getSemanticsImpl(attributeIndex);
         // VertexDescription.getComponentCount(semantics);
         for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++)
         {
             double v = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * index + icomp);
             outPoint.SetAttribute(semantics, icomp, v);
         }
     }
 }
 internal virtual void _interpolateTwoVertices(int vertex1, int vertex2, double f, com.epl.geometry.Point outPoint)
 {
     if (vertex1 < 0 || vertex1 >= m_pointCount)
     {
         throw new com.epl.geometry.GeometryException("index out of bounds.");
     }
     if (vertex2 < 0 || vertex2 >= m_pointCount)
     {
         throw new com.epl.geometry.GeometryException("index out of bounds.");
     }
     // _ASSERT(!IsEmpty());
     // _ASSERT(m_vertexAttributes != NULLPTR);
     _verifyAllStreams();
     outPoint.AssignVertexDescription(m_description);
     if (outPoint.IsEmpty())
     {
         outPoint._setToDefault();
     }
     for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
     {
         int semantics = m_description._getSemanticsImpl(attributeIndex);
         for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++)
         {
             double v1 = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * vertex1 + icomp);
             double v2 = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * vertex2 + icomp);
             outPoint.SetAttribute(semantics, icomp, com.epl.geometry.MathUtils.Lerp(v1, v2, f));
         }
     }
 }
Exemple #3
0
 private void _get(int endPoint, com.epl.geometry.Point outPoint)
 {
     if (IsEmptyImpl())
     {
         throw new com.epl.geometry.GeometryException("empty geometry");
     }
     // ._setToDefault();
     outPoint.AssignVertexDescription(m_description);
     if (outPoint.IsEmptyImpl())
     {
         outPoint._setToDefault();
     }
     for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
     {
         int semantics = m_description._getSemanticsImpl(attributeIndex);
         for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++)
         {
             double v = _getAttributeAsDbl(endPoint, semantics, icomp);
             outPoint.SetAttribute(semantics, icomp, v);
         }
     }
 }
 // ////////////////// METHODS To REMOVE ///////////////////////
 public override com.epl.geometry.Point GetPoint(int index)
 {
     if (index < 0 || index >= m_pointCount)
     {
         throw new System.IndexOutOfRangeException();
     }
     _verifyAllStreams();
     com.epl.geometry.Point outPoint = new com.epl.geometry.Point();
     outPoint.AssignVertexDescription(m_description);
     if (outPoint.IsEmpty())
     {
         outPoint._setToDefault();
     }
     for (int attributeIndex = 0; attributeIndex < m_description.GetAttributeCount(); attributeIndex++)
     {
         int semantics = m_description.GetSemantics(attributeIndex);
         for (int icomp = 0, ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); icomp < ncomp; icomp++)
         {
             double v = m_vertexAttributes[attributeIndex].ReadAsDbl(ncomp * index + icomp);
             outPoint.SetAttribute(semantics, icomp, v);
         }
     }
     return(outPoint);
 }