curvature_1 = geompy.CurvatureOnFace(Sph, pXYZ, OX, 'curvature_sph_pXYZ_OX')
curvature_2 = geompy.CurvatureOnFace(Sph, pXYZ, vZ_XY, 'curvature_sph_pXYZ_vt')
curvature_3 = geompy.CurvatureOnFace(Sph, pY, OX, 'curvature_sph_pY_OX')
+# Pole
+curvature_p = geompy.CurvatureOnFace(Sph, pZ, OX, 'curvature_sph_pZ_OX')
# All sphere curvature radiuces = R
assert(abs(geompy.BasicProperties(curvature_1)[0] - R) < 1e-07)
assert(abs(geompy.BasicProperties(curvature_2)[0] - R) < 1e-07)
assert(abs(geompy.BasicProperties(curvature_3)[0] - R) < 1e-07)
+assert(abs(geompy.BasicProperties(curvature_p)[0] - R) < 1e-07)
# Normal direction
isExcept = False
isExcept = True
assert(isExcept)
-# Pole (min and max curvatures are not defined, find via line projection?)
-isExcept = False
-try:
- geompy.CurvatureOnFace(Sph, pZ, OX, 'curvature_sph_pZ_OX')
-except:
- isExcept = True
- print(geompy.MeasuOp.GetErrorCode())
-assert(isExcept)
-
# II. Curvature of a Cylinder
Cylinder_1 = geompy.MakeCylinderRH(R, 300, 'Cylinder_1')
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True, "Face")
// Calculate differential properties
BRepAdaptor_Surface aSurfAdapt (aFace);
BRepLProp_SLProps Props (aSurfAdapt, UV.X(), UV.Y(), 2, 1e-7);
- if (!Props.IsCurvatureDefined())
- Standard_ConstructionError::Raise("Curvature calculation failed");
+ if (!Props.IsNormalDefined())
+ Standard_ConstructionError::Raise
+ ("Curvature calculation failed: normal direction is not defined");
// Get differential properties
gp_Vec Xu = Props.D1U();
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True, "Face")
curvature_1 = geompy.CurvatureOnFace(Face_2, px, vy, 'curvature_cyl_px_vy')
assert(abs(geompy.BasicProperties(curvature_1)[0] - 100) < 1e-07)
+ curvature_zero = geompy.CurvatureOnFace(Face_2, px, vz)
+ assert(geompy.MeasuOp.GetErrorCode() == "ZERO_CURVATURE")
+ assert(not curvature_zero)
isExcept = False
try:
- geompy.CurvatureOnFace(Face_2, px, vz)
+ # p0 is on cylinder axis, projection should fail
+ geompy.CurvatureOnFace(Face_2, p0, vy)
except:
isExcept = True
- assert(geompy.MeasuOp.GetErrorCode() == "Curvature radius is infinite")
assert(isExcept)
print("DONE")