geom/doc/salome/gui/GEOM/input/tui_angle.doc

54 lines
1.2 KiB
Plaintext
Raw Normal View History

2012-04-18 15:17:03 +06:00
/*!
\page tui_angle_page Angle
\code
import salome
salome.salome_init()
import math
import geompy
geompy.init_geom(salome.myStudy)
OX = geompy.MakeVectorDXDYDZ(10, 0,0)
OXY = geompy.MakeVectorDXDYDZ(10,10,0)
# in one plane
Angle = geompy.GetAngle(OX, OXY)
print "\nAngle between OX and OXY = ", Angle
if math.fabs(Angle - 45.0) > 1e-05:
print " Error: returned angle is", Angle, "while must be 45.0"
pass
Angle = geompy.GetAngleRadians(OX, OXY)
print "\nAngle between OX and OXY in radians = ", Angle
if math.fabs(Angle - math.pi/4) > 1e-05:
print " Error: returned angle is", Angle, "while must be pi/4"
pass
# not in one plane
OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
Angle = geompy.GetAngle(OX, OXY_shift)
print "Angle between OX and OXY_shift = ", Angle
if math.fabs(Angle - 45.0) > 1e-05:
print " Error: returned angle is", Angle, "while must be 45.0"
pass
# not linear
pnt1 = geompy.MakeVertex(0, 0, 0)
pnt2 = geompy.MakeVertex(10, 0, 0)
pnt3 = geompy.MakeVertex(20, 10, 0)
arc = geompy.MakeArc(pnt1, pnt2, pnt3)
Angle = geompy.GetAngle(OX, arc)
if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()):
print "Error. Angle must not be computed on curvilinear edges"
pass
\endcode
*/