geom/doc/salome/gui/GEOM/input/tui_angle.doc
2012-08-09 07:58:02 +00:00

68 lines
1.7 KiB
Plaintext

/*!
\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
Angle = geompy.GetAngleVectors(OX, OXY, True)
print "\nAngle between vectors 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.GetAngleRadiansVectors(OX, OXY, False)
print "\nBig angle between vectors OX and OXY in radians = ", Angle
if math.fabs(Angle - math.pi*7./4.) > 1e-05:
print " Error: returned angle is", Angle, "while must be 7*pi/4"
pass
# not in one plane
OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
Angle = geompy.GetAngle(OX, OXY_shift)
print "\nAngle 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
*/