MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / AddFacet

Method AddFacet

src/Mod/Inspection/App/InspectionFeature.cpp:205–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203 }
204
205 void AddFacet(const MeshCore::MeshGeomFacet& rclFacet, unsigned long ulFacetIndex)
206 {
207 unsigned long ulX1;
208 unsigned long ulY1;
209 unsigned long ulZ1;
210 unsigned long ulX2;
211 unsigned long ulY2;
212 unsigned long ulZ2;
213
214 Base::BoundBox3f clBB;
215 clBB.Add(rclFacet._aclPoints[0]);
216 clBB.Add(rclFacet._aclPoints[1]);
217 clBB.Add(rclFacet._aclPoints[2]);
218
219 Pos(Base::Vector3f(clBB.MinX, clBB.MinY, clBB.MinZ), ulX1, ulY1, ulZ1);
220 Pos(Base::Vector3f(clBB.MaxX, clBB.MaxY, clBB.MaxZ), ulX2, ulY2, ulZ2);
221
222
223 if ((ulX1 < ulX2) || (ulY1 < ulY2) || (ulZ1 < ulZ2)) {
224 for (unsigned long ulX = ulX1; ulX <= ulX2; ulX++) {
225 for (unsigned long ulY = ulY1; ulY <= ulY2; ulY++) {
226 for (unsigned long ulZ = ulZ1; ulZ <= ulZ2; ulZ++) {
227 if (rclFacet.IntersectBoundingBox(GetBoundBox(ulX, ulY, ulZ))) {
228 _aulGrid[ulX][ulY][ulZ].insert(ulFacetIndex);
229 }
230 }
231 }
232 }
233 }
234 else {
235 _aulGrid[ulX1][ulY1][ulZ1].insert(ulFacetIndex);
236 }
237 }
238
239 void InitGrid() override
240 {

Callers

nothing calls this directly

Calls 4

IntersectBoundingBoxMethod · 0.80
GetBoundBoxFunction · 0.50
AddMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected