EDF 2357 : added pure tui DotProduct and CrossProduct functions

This commit is contained in:
rnc 2013-02-07 17:54:12 +00:00
parent 8790b4de04
commit d94a57a70c

View File

@ -8736,6 +8736,60 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("PointCoordinates", self.MeasuOp) RaiseIfFailed("PointCoordinates", self.MeasuOp)
return aTuple return aTuple
## Get vector coordinates
# @return [x, y, z]
#
# @ref tui_measurement_tools_page "Example"
def VectorCoordinates(self,Vector):
"""
Get vector coordinates
Returns:
[x, y, z]
"""
p1=self.GetFirstVertex(Vector)
p2=self.GetLastVertex(Vector)
X1=self.PointCoordinates(p1)
X2=self.PointCoordinates(p2)
return (X2[0]-X1[0],X2[1]-X1[1],X2[2]-X1[2])
## Compute cross product
# @return vector w=u^v
#
# @ref tui_measurement_tools_page "Example"
def CrossProduct(self, Vector1, Vector2):
"""
Compute cross product
Returns: vector w=u^v
"""
u=self.VectorCoordinates(Vector1)
v=self.VectorCoordinates(Vector2)
w=self.MakeVectorDXDYDZ(u[1]*v[2]-u[2]*v[1], u[2]*v[0]-u[0]*v[2], u[0]*v[1]-u[1]*v[0])
return w
## Compute cross product
# @return dot product p=u.v
#
# @ref tui_measurement_tools_page "Example"
def DotProduct(self, Vector1, Vector2):
"""
Compute cross product
Returns: dot product p=u.v
"""
u=self.VectorCoordinates(Vector1)
v=self.VectorCoordinates(Vector2)
p=u[0]*v[0]+u[1]*v[1]+u[2]*v[2]
return p
## Get summarized length of all wires, ## Get summarized length of all wires,
# area of surface and volume of the given shape. # area of surface and volume of the given shape.
# @param theShape Shape to define properties of. # @param theShape Shape to define properties of.