point3

class guerilla.point3

Bases: object

A 3 dimension point class

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))    
2.0
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))  
20.0
getlength()

Returns the magnitude of the vector

Return type:float

Examples:

>>> v = point3 (10,0,0)
>>> v.getlength () 
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()        
(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()        
(1.0, 2.0, 1.0)
getnormalized()

Returns the normalized vector

Return type:point3

Examples:

>>> v = point3 (1,2,3).getnormalized ()
>>> v.getlength () 
0.999999...
getsqlength()

Returns the squar magnitude of the vector

Return type:float

Examples:

>>> v = point3 (10,0,0)
>>> v.getsqlength () 
100.0
getx()

Returns the x component.

Returns:The x component
Return type:float

Examples:

>>> p = point3 (1,2,3)
>>> p.getx() 
1.0
gety()

Returns the y component.

Returns:The y component
Return type:float

Examples:

>>> p = point3 (1,2,3)
>>> p.gety() 
2.0
getz()

Returns the z component.

Returns:The z component
Return type:float

Examples:

>>> p = point3 (1,2,3)
>>> p.getz() 
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 () 
True
>>> (v/0).isreal () 
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 ()           
4.0
sety(value)

Set the y component.

Parameters:value – The component value
Type:float

Examples:

>>> p = point3 (1,2,3)
>>> p.sety (4)
>>> p.gety ()           
4.0
setz(value)

Set the z component.

Parameters:value – The component value
Type:float

Examples:

>>> p = point3 (1,2,3)
>>> p.setz (4)
>>> p.getz ()           
4.0