return tol;
}
+bool CheckAlmostZero(gp_Vec & vec1,gp_Vec & vec2, gp_Vec & vecref)
+{
+ auto v1 = gp_Dir(vec1);
+ auto v2 = gp_Dir(vec2);
+ auto vref = gp_Dir(vecref);
+ auto XYZ = v1.Crossed (v2);
+ double cond = XYZ.X()*vref.X()+XYZ.Y()*vref.Y()+XYZ.Z()*vref.Z();
+ return (Abs(cond) <= 1e-12);
+}
+
//================================================================================
/*!
* \brief Return an angle between two EDGEs sharing a common VERTEX with reference
if ( theE2.Orientation() /*GetSubShapeOri( F, theE2 )*/ == TopAbs_REVERSED )
vec2.Reverse();
angle = vec1.AngleWithRef( vec2, vecRef );
-
+ if ( angle < 0. && CheckAlmostZero(vec1,vec2,vecRef))
+ angle*=-1;
+
if ( Abs ( angle ) >= 0.99 * M_PI )
{
BRep_Tool::Range( theE1, f, l );
# --- tube coude sain
- geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
+ #Refactor to perform the partition in two steps to avoid break from occt (reported bug#)
+ #geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
+ geometrieSaine0 = geompy.MakePartition([tube_1, coude], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
+ geometrieSaine = geompy.MakePartition([geometrieSaine0, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
geomPublish(initLog.debug, geometrieSaine, self.nomCas, self.numeroCas )
[P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True)
print("Nb Segments:", nb_segments)
print("Nb Points:", nb_points)
- assert nb_triangles == 12
- assert nb_points == 8
+ assert nb_triangles == 12*2
+ assert nb_points == 14
assert nb_segments == 12
if __name__ == "__main__":