point3¶
-
class
guerilla.
point3
¶ Bases:
object
A 3 dimension point class
-
cross
(other)¶ Returns the cross product between self and other
Parameters: other ( point3
) –Return type: point3
-
distance
(other)¶ Returns the distance between self and other
Parameters: other ( point3
) –Return type: float Examples:
>>> point3 (0,1,0).distance (point3 (0,3,0)) # doctest: +ELLIPSIS 2.0
-
dot
(other)¶ Returns the dot product between self and other
Parameters: other ( point3
) –Return type: float
-
dotproduct
(other)¶ Returns the dot product between self and other
Parameters: other ( point3
) –Return type: float Examples:
>>> point3 (1,2,3).dotproduct (point3 (2,3,4)) # doctest: +ELLIPSIS 20.0
-
getlength
()¶ Returns the magnitude of the vector
Return type: float Examples:
>>> v = point3 (10,0,0) >>> v.getlength () # doctest: +ELLIPSIS 10.0
-
getmax
(other)¶ Returns the max of each components
Parameters: other ( point3
/float) –Returns: (max (self.X, other.X), max (self.Y, other.Y), max (self.Z, other.Z)) Return type: point3
Examples:
>>> p = point3 (1,2,3).getmax (point3 (3,2,1)) >>> p.getx(), p.gety(), p.getz() # doctest: +ELLIPSIS (3.0, 2.0, 3.0)
-
getmin
(other)¶ Returns the min of each components
Parameters: other ( point3
/float) –Returns: (min (self.X, other.X), min (self.Y, other.Y), min (self.Z, other.Z)) Return type: point3
Examples:
>>> p = point3 (1,2,3).getmin (point3 (3,2,1)) >>> p.getx(), p.gety(), p.getz() # doctest: +ELLIPSIS (1.0, 2.0, 1.0)
-
getnormalized
()¶ Returns the normalized vector
Return type: point3
Examples:
>>> v = point3 (1,2,3).getnormalized () >>> v.getlength () # doctest: +ELLIPSIS 0.999999...
-
getsqlength
()¶ Returns the squar magnitude of the vector
Return type: float Examples:
>>> v = point3 (10,0,0) >>> v.getsqlength () # doctest: +ELLIPSIS 100.0
-
getx
()¶ Returns the x component.
Returns: The x component Return type: float Examples:
>>> p = point3 (1,2,3) >>> p.getx() # doctest: +ELLIPSIS 1.0
-
gety
()¶ Returns the y component.
Returns: The y component Return type: float Examples:
>>> p = point3 (1,2,3) >>> p.gety() # doctest: +ELLIPSIS 2.0
-
getz
()¶ Returns the z component.
Returns: The z component Return type: float Examples:
>>> p = point3 (1,2,3) >>> p.getz() # doctest: +ELLIPSIS 3.0
-
isreal
()¶ Returns true if the point is a correct number, false if NAN or INF
Return type: bool Examples:
>>> v = point3 (10,0,0) >>> (v/1).isreal () # doctest: +ELLIPSIS True >>> (v/0).isreal () # doctest: +ELLIPSIS False
-
setx
(value)¶ Set the x component.
Parameters: value – The component value Type: float Examples:
>>> p = point3 (1,2,3) >>> p.setx (4) >>> p.getx () # doctest: +ELLIPSIS 4.0
-