- i = 1;
- E = aQuads[0]->edge[i];
- C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
- TopExp::Vertices(E, VFirst, VLast);
- isForward = (((l - f) * (aQuads[0]->last[i] - aQuads[0]->first[i])) > 0);
- if (isForward)
- aCube.V101 = VLast; // will be (1,0,1) on the unit cube
- else
- aCube.V101 = VFirst;
-
- i = 2;
- E = aQuads[0]->edge[i];
- C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
- TopExp::Vertices(E, VFirst, VLast);
- isForward = (((l - f) * (aQuads[0]->last[i] - aQuads[0]->first[i])) > 0);
- if (isForward)
- aCube.V001 = VLast; // will be (0,0,1) on the unit cube
- else
- aCube.V001 = VFirst;
-
- // 1.4 - find edge X=0, Z=0 (ancestor of V000 not in face Y=0)
- // - find edge X=1, Z=0 (ancestor of V100 not in face Y=0)
- // - find edge X=1, Z=1 (ancestor of V101 not in face Y=0)
- // - find edge X=0, Z=1 (ancestor of V001 not in face Y=0)
- //MESSAGE("---");
-
- TopoDS_Edge E_0Y0 = EdgeNotInFace(aMesh, aShape, F, aCube.V000, MS);
- ASSERT(!E_0Y0.IsNull());
-
- TopoDS_Edge E_1Y0 = EdgeNotInFace(aMesh, aShape, F, aCube.V100, MS);
- ASSERT(!E_1Y0.IsNull());
-
- TopoDS_Edge E_1Y1 = EdgeNotInFace(aMesh, aShape, F, aCube.V101, MS);
- ASSERT(!E_1Y1.IsNull());
-
- TopoDS_Edge E_0Y1 = EdgeNotInFace(aMesh, aShape, F, aCube.V001, MS);
- ASSERT(!E_0Y1.IsNull());
-
- // 1.5 - identify the 4 vertices in face Y=1: V010, V110, V111, V011
- //MESSAGE("---");
-
- TopExp::Vertices(E_0Y0, VFirst, VLast);
- if (VFirst.IsSame(aCube.V000))
- aCube.V010 = VLast;
- else
- aCube.V010 = VFirst;
-
- TopExp::Vertices(E_1Y0, VFirst, VLast);
- if (VFirst.IsSame(aCube.V100))
- aCube.V110 = VLast;
- else
- aCube.V110 = VFirst;
-
- TopExp::Vertices(E_1Y1, VFirst, VLast);
- if (VFirst.IsSame(aCube.V101))
- aCube.V111 = VLast;
- else
- aCube.V111 = VFirst;
-
- TopExp::Vertices(E_0Y1, VFirst, VLast);
- if (VFirst.IsSame(aCube.V001))
- aCube.V011 = VLast;
- else
- aCube.V011 = VFirst;
+ aCube.V000 = aQuads[0]->side[0]->FirstVertex(); // will be (0,0,0) on the unit cube
+ aCube.V100 = aQuads[0]->side[0]->LastVertex(); // will be (1,0,0) on the unit cube
+ aCube.V001 = aQuads[0]->side[2]->FirstVertex(); // will be (0,0,1) on the unit cube
+ aCube.V101 = aQuads[0]->side[2]->LastVertex(); // will be (1,0,1) on the unit cube
+
+ TopTools_IndexedMapOfShape MV0;
+ TopExp::MapShapes(F, TopAbs_VERTEX, MV0);
+
+ aCube.V010 = OppositeVertex( aCube.V000, MV0, aQuads);
+ aCube.V110 = OppositeVertex( aCube.V100, MV0, aQuads);
+ aCube.V011 = OppositeVertex( aCube.V001, MV0, aQuads);
+ aCube.V111 = OppositeVertex( aCube.V101, MV0, aQuads);