mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-26 13:40:32 +05:00
Debug
This commit is contained in:
parent
2d6c2bb07d
commit
6f7a37a47b
@ -29,11 +29,14 @@ Sphere_1 = geompy.MakeSphereR(R, 'Sphere_1')
|
|||||||
curvature_1 = geompy.CurvatureOnFace(Sph, pXYZ, OX, 'curvature_sph_pXYZ_OX')
|
curvature_1 = geompy.CurvatureOnFace(Sph, pXYZ, OX, 'curvature_sph_pXYZ_OX')
|
||||||
curvature_2 = geompy.CurvatureOnFace(Sph, pXYZ, vZ_XY, 'curvature_sph_pXYZ_vt')
|
curvature_2 = geompy.CurvatureOnFace(Sph, pXYZ, vZ_XY, 'curvature_sph_pXYZ_vt')
|
||||||
curvature_3 = geompy.CurvatureOnFace(Sph, pY, OX, 'curvature_sph_pY_OX')
|
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
|
# All sphere curvature radiuces = R
|
||||||
assert(abs(geompy.BasicProperties(curvature_1)[0] - R) < 1e-07)
|
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_2)[0] - R) < 1e-07)
|
||||||
assert(abs(geompy.BasicProperties(curvature_3)[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
|
# Normal direction
|
||||||
isExcept = False
|
isExcept = False
|
||||||
@ -43,15 +46,6 @@ except:
|
|||||||
isExcept = True
|
isExcept = True
|
||||||
assert(isExcept)
|
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
|
# II. Curvature of a Cylinder
|
||||||
Cylinder_1 = geompy.MakeCylinderRH(R, 300, 'Cylinder_1')
|
Cylinder_1 = geompy.MakeCylinderRH(R, 300, 'Cylinder_1')
|
||||||
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True, "Face")
|
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True, "Face")
|
||||||
|
@ -113,8 +113,9 @@ TopoDS_Shape EvaluateAlongCurvature(const TopoDS_Shape& theFace,
|
|||||||
// Calculate differential properties
|
// Calculate differential properties
|
||||||
BRepAdaptor_Surface aSurfAdapt (aFace);
|
BRepAdaptor_Surface aSurfAdapt (aFace);
|
||||||
BRepLProp_SLProps Props (aSurfAdapt, UV.X(), UV.Y(), 2, 1e-7);
|
BRepLProp_SLProps Props (aSurfAdapt, UV.X(), UV.Y(), 2, 1e-7);
|
||||||
if (!Props.IsCurvatureDefined())
|
if (!Props.IsNormalDefined())
|
||||||
Standard_ConstructionError::Raise("Curvature calculation failed");
|
Standard_ConstructionError::Raise
|
||||||
|
("Curvature calculation failed: normal direction is not defined");
|
||||||
|
|
||||||
// Get differential properties
|
// Get differential properties
|
||||||
gp_Vec Xu = Props.D1U();
|
gp_Vec Xu = Props.D1U();
|
||||||
|
@ -600,12 +600,15 @@ def TestAll (geompy, math):
|
|||||||
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True, "Face")
|
[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')
|
curvature_1 = geompy.CurvatureOnFace(Face_2, px, vy, 'curvature_cyl_px_vy')
|
||||||
assert(abs(geompy.BasicProperties(curvature_1)[0] - 100) < 1e-07)
|
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
|
isExcept = False
|
||||||
try:
|
try:
|
||||||
geompy.CurvatureOnFace(Face_2, px, vz)
|
# p0 is on cylinder axis, projection should fail
|
||||||
|
geompy.CurvatureOnFace(Face_2, p0, vy)
|
||||||
except:
|
except:
|
||||||
isExcept = True
|
isExcept = True
|
||||||
assert(geompy.MeasuOp.GetErrorCode() == "Curvature radius is infinite")
|
|
||||||
assert(isExcept)
|
assert(isExcept)
|
||||||
|
|
||||||
print("DONE")
|
print("DONE")
|
||||||
|
Loading…
Reference in New Issue
Block a user