mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-26 21:00:34 +05:00
IMP 0021537: [CEA 554] Add behaviour in GetAngle and GetAngleRadians.
This commit is contained in:
parent
aa37ece780
commit
2ad649ad04
@ -28,11 +28,25 @@ 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 "Angle between OX and OXY_shift = ", Angle
|
||||
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
|
||||
|
@ -6638,6 +6638,47 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
RaiseIfFailed("GetAngle", self.MeasuOp)
|
||||
return anAngle
|
||||
|
||||
## Get angle between the given vectors in degrees.
|
||||
# @param theShape1,theShape2 Vectors to find angle between.
|
||||
# @param theFlag If True, the normal vector is defined by the two vectors cross,
|
||||
# if False, the opposite vector to the normal vector is used.
|
||||
# @return Value of the angle between the given vectors in degrees.
|
||||
#
|
||||
# @ref tui_measurement_tools_page "Example"
|
||||
def GetAngleVectors(self, theShape1, theShape2, theFlag = True):
|
||||
"""
|
||||
Get angle between the given vectors in degrees.
|
||||
|
||||
Parameters:
|
||||
theShape1,theShape2 Vectors to find angle between.
|
||||
theFlag If True, the normal vector is defined by the two vectors cross,
|
||||
if False, the opposite vector to the normal vector is used.
|
||||
|
||||
Returns:
|
||||
Value of the angle between the given vectors in degrees.
|
||||
"""
|
||||
anAngle = self.MeasuOp.GetAngleBtwVectors(theShape1, theShape2)
|
||||
if not theFlag:
|
||||
anAngle = 360. - anAngle
|
||||
RaiseIfFailed("GetAngleVectors", self.MeasuOp)
|
||||
return anAngle
|
||||
|
||||
## The same as GetAngleVectors, but the result is in radians.
|
||||
def GetAngleRadiansVectors(self, theShape1, theShape2, theFlag = True):
|
||||
"""
|
||||
Get angle between the given vectors in radians.
|
||||
|
||||
Parameters:
|
||||
theShape1,theShape2 Vectors to find angle between.
|
||||
theFlag If True, the normal vector is defined by the two vectors cross,
|
||||
if False, the opposite vector to the normal vector is used.
|
||||
|
||||
Returns:
|
||||
Value of the angle between the given vectors in radians.
|
||||
"""
|
||||
anAngle = self.GetAngleVectors(theShape1, theShape2, theFlag)*math.pi/180.
|
||||
return anAngle
|
||||
|
||||
## @name Curve Curvature Measurement
|
||||
# Methods for receiving radius of curvature of curves
|
||||
# in the given point
|
||||
|
Loading…
Reference in New Issue
Block a user