Ejemplo n.º 1
0
    void checkPoints(size_t start, size_t end) const
    {
      float radius = 0.0f;
      float distToBoundary = 0.0f;
      int64_t numPoints = m_Points->getNumberOfVertices();
      FloatArrayType::Pointer llPtr = FloatArrayType::CreateArray(3, "_INTERNAL_USE_ONLY_Lower");
      FloatArrayType::Pointer urPtr = FloatArrayType::CreateArray(3, "_INTERNAL_USE_ONLY_Upper_Right");
      float* ll = llPtr->getPointer(0);
      float* ur = urPtr->getPointer(0);
      float* point = NULL;
      char code = ' ';

      for (size_t iter = start; iter < end; iter++)
      {
        // find bounding box for current feature
        GeometryMath::FindBoundingBoxOfFaces(m_Faces, m_FaceIds->getElementList(iter), ll, ur);
        GeometryMath::FindDistanceBetweenPoints(ll, ur, radius);

        // check points in vertex array to see if they are in the bounding box of the feature
        for (int64_t i = 0; i < numPoints; i++)
        {
          point = m_Points->getVertexPointer(i);
          if (m_PolyIds[i] == 0 && GeometryMath::PointInBox(point, ll, ur) == true)
          {
            code = GeometryMath::PointInPolyhedron(m_Faces, m_FaceIds->getElementList(iter), m_FaceBBs, point, ll, ur, radius, distToBoundary);
            if (code == 'i' || code == 'V' || code == 'E' || code == 'F') { m_PolyIds[i] = iter; }
          }
        }
      }
    }
Ejemplo n.º 2
0
    void checkPoints(size_t start, size_t end) const
    {
      float radius = 0.0f;
      FloatArrayType::Pointer llPtr = FloatArrayType::CreateArray(3, "_INTERNAL_USE_ONLY_Lower_Left");
      FloatArrayType::Pointer urPtr = FloatArrayType::CreateArray(3, "_INTERNAL_USE_ONLY_Upper_Right");
      FloatArrayType::Pointer ll_rotPtr = FloatArrayType::CreateArray(3, "_INTERNAL_USE_ONLY_Lower_Left_Rotated");
      FloatArrayType::Pointer ur_rotPtr = FloatArrayType::CreateArray(3, "_INTERNAL_USE_ONLY_Upper_Right_Rotated");
      float* ll = llPtr->getPointer(0);
      float* ur = urPtr->getPointer(0);
      float* ll_rot = ll_rotPtr->getPointer(0);
      float* ur_rot = ur_rotPtr->getPointer(0);
      float* point = NULL;
      char code = ' ';
      float g[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } };

      for (size_t iter = start; iter < end; iter++)
      {
        Int32Int32DynamicListArray::ElementList& faceIds = m_FaceIds->getElementList(iter);

        FOrientArrayType om(9, 0.0);
        FOrientTransformsType::qu2om(FOrientArrayType(m_AvgQuats[iter]), om);
        om.toGMatrix(g);

        // find bounding box for current feature
        GeometryMath::FindBoundingBoxOfFaces(m_Faces, faceIds, ll, ur);
        GeometryMath::FindBoundingBoxOfRotatedFaces(m_Faces, faceIds, g, ll_rot, ur_rot);
        GeometryMath::FindDistanceBetweenPoints(ll, ur, radius);

        generatePoints(iter, m_Points, m_InFeature, m_AvgQuats, m_LatticeConstants, m_Basis, ll_rot, ur_rot);

        // check points in vertex array to see if they are in the bounding box of the feature
        int64_t numPoints = m_Points[iter]->getNumberOfVertices();
        VertexGeom::Pointer vertArray = m_Points[iter];
        BoolArrayType::Pointer boolArray = m_InFeature[iter];
        for (int64_t i = 0; i < numPoints; i++)
        {
          point = vertArray->getVertexPointer(i);
          if (boolArray->getValue(i) == false)
          {
            code = GeometryMath::PointInPolyhedron(m_Faces, faceIds, m_FaceBBs, point, ll, ur, radius);
            if (code == 'i' || code == 'V' || code == 'E' || code == 'F') { m_InFeature[start]->setValue(i, true); }
          }
        }
      }
    }