Python Reference Guide
 
Loading...
Searching...
No Matches
FBVertex Class Reference

FBVertex class. More...

#include <pyfbsdk.h>

Public Member Functions

 FBVertex ()
 Default constructor.
 
 FBVertex (FBVertex pVertex)
 Copy constructor.
 
 FBVertex (float pX, float pY, float pZ, float pW)
 Constructor from components.
 
 FBVertex (object pObject)
 Constructor from a Python object with indexing support.
 
 FBVertex (list pList)
 Constructor from list.
 
int __len__ ()
 Returns the number of elements.
 
float __getitem__ (int pIndex)
 Returns the ith component.
 
void __setitem__ (int pIndex, float pValue)
 Sets the ith component.
 
str __repr__ ()
 Representation for debugging.
 
str __str__ ()
 String representation.
 
FBVertex __add__ (FBVertex pVertex)
 Addition operator with another vertex.
 
FBVertex __add__ (float pScalar)
 Addition operator with a scalar.
 
FBVertex __sub__ (FBVertex pVertex)
 Subtraction operator with another vertex.
 
FBVertex __sub__ (float pScalar)
 Subtraction operator with a scalar.
 
FBVertex __mul__ (FBVertex pVertex)
 Multiplication operator with another vertex (component-wise).
 
FBVertex __mul__ (float pScalar)
 Multiplication operator with a scalar.
 
FBVertex __div__ (FBVertex pVertex)
 Division operator with another vertex (component-wise).
 
FBVertex __div__ (float pScalar)
 Division operator with a scalar.
 
FBVertex __iadd__ (FBVertex pVertex)
 In-place addition with another vertex.
 
FBVertex __iadd__ (float pScalar)
 In-place addition with a scalar.
 
FBVertex __isub__ (FBVertex pVertex)
 In-place subtraction with another vertex.
 
FBVertex __isub__ (float pScalar)
 In-place subtraction with a scalar.
 
FBVertex __imul__ (FBVertex pVertex)
 In-place multiplication with another vertex (component-wise).
 
FBVertex __imul__ (float pScalar)
 In-place multiplication with a scalar.
 
FBVertex __idiv__ (FBVertex pVertex)
 In-place division with another vertex (component-wise).
 
FBVertex __idiv__ (float pScalar)
 In-place division with a scalar.
 
FBVertex __neg__ ()
 Unary negation operator.
 
FBVertex CopyFrom (FBVertex pVertex)
 Copy values from another vertex.
 
FBVertex CopyFrom (list pList)
 Copy values from a list.
 
bool NotEqual (FBVertex pVertex)
 Compare for inequality.
 
bool IsEqual (FBVertex pVertex)
 Compare for equality.
 
float Length ()
 Get the length (magnitude) of the vertex vector.
 
float SquareLength ()
 Get the squared length of the vertex vector.
 
float Distance (FBVertex pVertex)
 Calculate the distance to another vertex.
 
FBVertex Normalize ()
 Normalize the vector (make it unit length).
 
float DotProduct (FBVertex pVertex)
 Calculate the dot product with another vertex.
 
FBVertex CrossProduct (FBVertex pVertex)
 Calculate the cross product with another vertex.
 
int GetBufferAddress ()
 Get the buffer address for the vertex data.
 
list GetList ()
 Get the vertex as a list.
 

Detailed Description

FBVertex class.

A vertex represents a point in 3D space, stored as 4 float values (x, y, z, w). Similar in use to FBVector4d

# Supported list protocol methods:
v = FBVertex()
len(v)
print v[0]
v[0] = 1.0
FBVertex()
Default constructor.
Warning
Slicing is not supported by this object.

Constructor & Destructor Documentation

◆ FBVertex() [1/5]

◆ FBVertex() [2/5]

FBVertex ( FBVertex pVertex)

Copy constructor.

Parameters
pVertexVertex to copy.

References FBVertex().

◆ FBVertex() [3/5]

FBVertex ( float pX,
float pY,
float pZ,
float pW )

Constructor from components.

Parameters
pXX component.
pYY component.
pZZ component.
pWW component.

◆ FBVertex() [4/5]

FBVertex ( object pObject)

Constructor from a Python object with indexing support.

Parameters
pObjectObject with len and indexing support containing 4 float values.

◆ FBVertex() [5/5]

FBVertex ( list pList)

Constructor from list.

Parameters
pListList of 4 float values.

Member Function Documentation

◆ __add__() [1/2]

FBVertex __add__ ( FBVertex pVertex)

Addition operator with another vertex.

Corresponds to python: v1 + v2

Parameters
pVertexVertex to add.
Returns
A new FBVertex with the result.

References FBVertex().

◆ __add__() [2/2]

FBVertex __add__ ( float pScalar)

Addition operator with a scalar.

Corresponds to python: v + 2.0

Parameters
pScalarScalar value to add to each component.
Returns
A new FBVertex with the result.

References FBVertex().

◆ __div__() [1/2]

FBVertex __div__ ( FBVertex pVertex)

Division operator with another vertex (component-wise).

Corresponds to python: v1 / v2

Parameters
pVertexVertex to divide by.
Returns
A new FBVertex with the result.

References FBVertex().

◆ __div__() [2/2]

FBVertex __div__ ( float pScalar)

Division operator with a scalar.

Corresponds to python: v / 2.0

Parameters
pScalarScalar value to divide each component by.
Returns
A new FBVertex with the result.

References FBVertex().

◆ __getitem__()

float __getitem__ ( int pIndex)

Returns the ith component.

Corresponds to python: print v[1]

Parameters
pIndexIndex of the component to get (0 to 3).
Returns
Vertex component value.

◆ __iadd__() [1/2]

FBVertex __iadd__ ( FBVertex pVertex)

In-place addition with another vertex.

Corresponds to python: v1 += v2

Parameters
pVertexVertex to add.
Returns
Self.

References FBVertex().

◆ __iadd__() [2/2]

FBVertex __iadd__ ( float pScalar)

In-place addition with a scalar.

Corresponds to python: v += 2.0

Parameters
pScalarScalar value to add to each component.
Returns
Self.

References FBVertex().

◆ __idiv__() [1/2]

FBVertex __idiv__ ( FBVertex pVertex)

In-place division with another vertex (component-wise).

Corresponds to python: v1 /= v2

Parameters
pVertexVertex to divide by.
Returns
Self.

References FBVertex().

◆ __idiv__() [2/2]

FBVertex __idiv__ ( float pScalar)

In-place division with a scalar.

Corresponds to python: v /= 2.0

Parameters
pScalarScalar value to divide each component by.
Returns
Self.

References FBVertex().

◆ __imul__() [1/2]

FBVertex __imul__ ( FBVertex pVertex)

In-place multiplication with another vertex (component-wise).

Corresponds to python: v1 *= v2

Parameters
pVertexVertex to multiply.
Returns
Self.

References FBVertex().

◆ __imul__() [2/2]

FBVertex __imul__ ( float pScalar)

In-place multiplication with a scalar.

Corresponds to python: v *= 2.0

Parameters
pScalarScalar value to multiply each component.
Returns
Self.

References FBVertex().

◆ __isub__() [1/2]

FBVertex __isub__ ( FBVertex pVertex)

In-place subtraction with another vertex.

Corresponds to python: v1 -= v2

Parameters
pVertexVertex to subtract.
Returns
Self.

References FBVertex().

◆ __isub__() [2/2]

FBVertex __isub__ ( float pScalar)

In-place subtraction with a scalar.

Corresponds to python: v -= 2.0

Parameters
pScalarScalar value to subtract from each component.
Returns
Self.

References FBVertex().

◆ __len__()

int __len__ ( )

Returns the number of elements.

Corresponds to python: len(object)

Returns
Number of elements (4).

◆ __mul__() [1/2]

FBVertex __mul__ ( FBVertex pVertex)

Multiplication operator with another vertex (component-wise).

Corresponds to python: v1 * v2

Parameters
pVertexVertex to multiply.
Returns
A new FBVertex with the result.

References FBVertex().

◆ __mul__() [2/2]

FBVertex __mul__ ( float pScalar)

Multiplication operator with a scalar.

Corresponds to python: v * 2.0

Parameters
pScalarScalar value to multiply each component.
Returns
A new FBVertex with the result.

References FBVertex().

◆ __neg__()

FBVertex __neg__ ( )

Unary negation operator.

Corresponds to python: -v

Returns
A new FBVertex with negated components.

References FBVertex().

◆ __repr__()

str __repr__ ( )

Representation for debugging.

Corresponds to python: repr(v)

Returns
String representation for debugging.

◆ __setitem__()

void __setitem__ ( int pIndex,
float pValue )

Sets the ith component.

Corresponds to python: v[1] = 0.5

Parameters
pIndexIndex of the component to set (0 to 3).
pValueValue of the vertex component.

◆ __str__()

str __str__ ( )

String representation.

Corresponds to python: str(v) or print(v)

Returns
String representation of the vertex.

◆ __sub__() [1/2]

FBVertex __sub__ ( FBVertex pVertex)

Subtraction operator with another vertex.

Corresponds to python: v1 - v2

Parameters
pVertexVertex to subtract.
Returns
A new FBVertex with the result.

References FBVertex().

◆ __sub__() [2/2]

FBVertex __sub__ ( float pScalar)

Subtraction operator with a scalar.

Corresponds to python: v - 2.0

Parameters
pScalarScalar value to subtract from each component.
Returns
A new FBVertex with the result.

References FBVertex().

◆ CopyFrom() [1/2]

FBVertex CopyFrom ( FBVertex pVertex)

Copy values from another vertex.

Parameters
pVertexVertex to copy from.
Returns
A new FBVertex with copied values.

References FBVertex().

◆ CopyFrom() [2/2]

FBVertex CopyFrom ( list pList)

Copy values from a list.

Parameters
pListList of 4 float values.
Returns
A new FBVertex with copied values.

References FBVertex().

◆ CrossProduct()

FBVertex CrossProduct ( FBVertex pVertex)

Calculate the cross product with another vertex.

Parameters
pVertexVertex to calculate cross product with.
Returns
A new FBVertex representing the cross product.

References FBVertex().

◆ Distance()

float Distance ( FBVertex pVertex)

Calculate the distance to another vertex.

Parameters
pVertexVertex to calculate distance to.
Returns
The distance between the two vertices.

References FBVertex().

◆ DotProduct()

float DotProduct ( FBVertex pVertex)

Calculate the dot product with another vertex.

Parameters
pVertexVertex to calculate dot product with.
Returns
The dot product value.

References FBVertex().

◆ GetBufferAddress()

int GetBufferAddress ( )

Get the buffer address for the vertex data.

Returns
Buffer address as an integer.

◆ GetList()

list GetList ( )

Get the vertex as a list.

Returns
List of 4 float values.

◆ IsEqual()

bool IsEqual ( FBVertex pVertex)

Compare for equality.

Parameters
pVertexVertex to compare with.
Returns
True if vertices are equal.

References FBVertex().

◆ Length()

float Length ( )

Get the length (magnitude) of the vertex vector.

Returns
The length of the vertex vector.

◆ Normalize()

FBVertex Normalize ( )

Normalize the vector (make it unit length).

Returns
A new normalized FBVertex.

References FBVertex().

◆ NotEqual()

bool NotEqual ( FBVertex pVertex)

Compare for inequality.

Parameters
pVertexVertex to compare with.
Returns
True if vertices are not equal.

References FBVertex().

◆ SquareLength()

float SquareLength ( )

Get the squared length of the vertex vector.

More efficient than Length() when only comparing magnitudes.

Returns
The squared length of the vertex vector.