6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 OX = geompy.MakeVectorDXDYDZ(10, 0,0)
11 OXY = geompy.MakeVectorDXDYDZ(10,10,0)
14 Angle = geompy.GetAngle(OX, OXY)
16 print "\nAngle between OX and OXY = ", Angle
17 if math.fabs(Angle - 45.0) > 1e-05:
18 print " Error: returned angle is", Angle,
"while must be 45.0"
21 Angle = geompy.GetAngleRadians(OX, OXY)
23 print "\nAngle between OX and OXY in radians = ", Angle
24 if math.fabs(Angle - math.pi/4) > 1e-05:
25 print " Error: returned angle is", Angle,
"while must be pi/4"
28 Angle = geompy.GetAngleVectors(OX, OXY,
True)
30 print "\nAngle between vectors OX and OXY = ", Angle
31 if math.fabs(Angle - 45.0) > 1e-05:
32 print " Error: returned angle is", Angle,
"while must be 45.0"
35 Angle = geompy.GetAngleRadiansVectors(OX, OXY,
False)
37 print "\nBig angle between vectors OX and OXY in radians = ", Angle
38 if math.fabs(Angle - math.pi*7./4.) > 1e-05:
39 print " Error: returned angle is", Angle,
"while must be 7*pi/4"
43 OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
44 Angle = geompy.GetAngle(OX, OXY_shift)
46 print "\nAngle between OX and OXY_shift = ", Angle
47 if math.fabs(Angle - 45.0) > 1e-05:
48 print " Error: returned angle is", Angle,
"while must be 45.0"
52 pnt1 = geompy.MakeVertex(0, 0, 0)
53 pnt2 = geompy.MakeVertex(10, 0, 0)
54 pnt3 = geompy.MakeVertex(20, 10, 0)
55 arc = geompy.MakeArc(pnt1, pnt2, pnt3)
57 Angle = geompy.GetAngle(OX, arc)
63 assert (
not geompy.MeasuOp.IsDone() ),
'Angle must not be computed on curvilinear edges.'