[Part] Bullseye whitespace fixes
This commit is contained in:
@@ -79,11 +79,11 @@ std::string FaceMakerBullseye::getBriefExplanation() const
|
||||
|
||||
void FaceMakerBullseye::Build_Essence()
|
||||
{
|
||||
if(myWires.empty())
|
||||
if (myWires.empty())
|
||||
return;
|
||||
|
||||
//validity check
|
||||
for(TopoDS_Wire &w : myWires){
|
||||
for (TopoDS_Wire& w : myWires) {
|
||||
if (!BRep_Tool::IsClosed(w))
|
||||
throw Base::ValueError("Wire is not closed.");
|
||||
}
|
||||
@@ -91,16 +91,17 @@ void FaceMakerBullseye::Build_Essence()
|
||||
|
||||
//find plane (at the same time, test that all wires are on the same plane)
|
||||
gp_Pln plane;
|
||||
if(this->planeSupplied){
|
||||
if (this->planeSupplied) {
|
||||
plane = this->myPlane;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
TopoDS_Builder builder;
|
||||
TopoDS_Compound comp;
|
||||
builder.MakeCompound(comp);
|
||||
for(TopoDS_Wire &w : myWires){
|
||||
for (TopoDS_Wire& w : myWires) {
|
||||
builder.Add(comp, BRepBuilderAPI_Copy(w).Shape());
|
||||
}
|
||||
BRepLib_FindSurface planeFinder(comp,-1, /*OnlyPlane=*/Standard_True);
|
||||
BRepLib_FindSurface planeFinder(comp, -1, /*OnlyPlane=*/Standard_True);
|
||||
if (!planeFinder.Found())
|
||||
throw Base::ValueError("Wires are not coplanar.");
|
||||
plane = GeomAdaptor_Surface(planeFinder.Surface()).Plane();
|
||||
@@ -113,25 +114,26 @@ void FaceMakerBullseye::Build_Essence()
|
||||
//add wires one by one to current set of faces.
|
||||
//We go from last to first, to make it so that outer wires come before inner wires.
|
||||
std::vector< std::unique_ptr<FaceDriller> > faces;
|
||||
for (int i = static_cast<int>(wires.size())-1; i >= 0; --i) {
|
||||
TopoDS_Wire &w = wires[i];
|
||||
for (int i = static_cast<int>(wires.size()) - 1; i >= 0; --i) {
|
||||
TopoDS_Wire& w = wires[i];
|
||||
|
||||
//test if this wire is on any of existing faces (if yes, it's a hole;
|
||||
// if no, it's a beginning of a new face).
|
||||
//Since we are assuming the wires do not intersect, testing if one vertex of wire is in a face is enough.
|
||||
gp_Pnt p = BRep_Tool::Pnt(TopoDS::Vertex(TopExp_Explorer(w, TopAbs_VERTEX).Current()));
|
||||
FaceDriller* foundFace = nullptr;
|
||||
for(std::unique_ptr<FaceDriller> &ff : faces){
|
||||
if(ff->hitTest(p)){
|
||||
for (std::unique_ptr<FaceDriller>& ff : faces) {
|
||||
if (ff->hitTest(p)) {
|
||||
foundFace = &(*ff);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(foundFace){
|
||||
if (foundFace) {
|
||||
//wire is on a face.
|
||||
foundFace->addHole(w);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//wire is not on a face. Start a new face.
|
||||
faces.push_back(std::unique_ptr<FaceDriller>(
|
||||
new FaceDriller(plane, w)
|
||||
@@ -140,7 +142,7 @@ void FaceMakerBullseye::Build_Essence()
|
||||
}
|
||||
|
||||
//and we are done!
|
||||
for(std::unique_ptr<FaceDriller> &ff : faces){
|
||||
for (std::unique_ptr<FaceDriller>& ff : faces) {
|
||||
this->myShapesToReturn.push_back(ff->Face());
|
||||
}
|
||||
}
|
||||
@@ -163,16 +165,16 @@ FaceMakerBullseye::FaceDriller::FaceDriller(const gp_Pln& plane, TopoDS_Wire out
|
||||
|
||||
bool FaceMakerBullseye::FaceDriller::hitTest(const gp_Pnt& point) const
|
||||
{
|
||||
double u,v;
|
||||
GeomAPI_ProjectPointOnSurf(point, myHPlane).LowerDistanceParameters(u,v);
|
||||
BRepClass_FaceClassifier cl(myFace, gp_Pnt2d(u,v), Precision::Confusion());
|
||||
double u, v;
|
||||
GeomAPI_ProjectPointOnSurf(point, myHPlane).LowerDistanceParameters(u, v);
|
||||
BRepClass_FaceClassifier cl(myFace, gp_Pnt2d(u, v), Precision::Confusion());
|
||||
TopAbs_State ret = cl.State();
|
||||
switch(ret){
|
||||
case TopAbs_UNKNOWN:
|
||||
throw Base::ValueError("FaceMakerBullseye::FaceDriller::hitTest: result unknown.");
|
||||
switch (ret) {
|
||||
case TopAbs_UNKNOWN:
|
||||
throw Base::ValueError("FaceMakerBullseye::FaceDriller::hitTest: result unknown.");
|
||||
break;
|
||||
default:
|
||||
return ret == TopAbs_IN || ret == TopAbs_ON;
|
||||
default:
|
||||
return ret == TopAbs_IN || ret == TopAbs_ON;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user