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

FBNormal class. More...

#include <pyfbsdk.h>

Public Member Functions

 FBNormal ()
 Default constructor.
 
 FBNormal (FBNormal pNormal)
 Copy constructor.
 
 FBNormal (float pX, float pY, float pZ)
 Constructor from components.
 
 FBNormal (object pObject)
 Constructor from a Python object with indexing support.
 
 FBNormal (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.
 
FBNormal __add__ (FBNormal pNormal)
 Addition operator with another normal.
 
FBNormal __add__ (float pScalar)
 Addition operator with a scalar.
 
FBNormal __sub__ (FBNormal pNormal)
 Subtraction operator with another normal.
 
FBNormal __sub__ (float pScalar)
 Subtraction operator with a scalar.
 
FBNormal __mul__ (FBNormal pNormal)
 Multiplication operator with another normal (component-wise).
 
FBNormal __mul__ (float pScalar)
 Multiplication operator with a scalar.
 
FBNormal __div__ (FBNormal pNormal)
 Division operator with another normal (component-wise).
 
FBNormal __div__ (float pScalar)
 Division operator with a scalar.
 
FBNormal __iadd__ (FBNormal pNormal)
 In-place addition with another normal.
 
FBNormal __iadd__ (float pScalar)
 In-place addition with a scalar.
 
FBNormal __isub__ (FBNormal pNormal)
 In-place subtraction with another normal.
 
FBNormal __isub__ (float pScalar)
 In-place subtraction with a scalar.
 
FBNormal __imul__ (FBNormal pNormal)
 In-place multiplication with another normal (component-wise).
 
FBNormal __imul__ (float pScalar)
 In-place multiplication with a scalar.
 
FBNormal __idiv__ (FBNormal pNormal)
 In-place division with another normal (component-wise).
 
FBNormal __idiv__ (float pScalar)
 In-place division with a scalar.
 
FBNormal __neg__ ()
 Unary negation operator.
 
FBNormal CopyFrom (FBNormal pNormal)
 Copy values from another normal.
 
FBNormal CopyFrom (list pList)
 Copy values from a list.
 
bool NotEqual (FBNormal pNormal)
 Compare for inequality.
 
bool IsEqual (FBNormal pNormal)
 Compare for equality.
 
float Length ()
 Get the length (magnitude) of the normal.
 
float SquareLength ()
 Get the squared length of the normal.
 
FBNormal Normalize ()
 Normalize the vector (make it unit length).
 
float DotProduct (FBNormal pNormal)
 Calculate the dot product with another normal.
 
FBNormal CrossProduct (FBNormal pNormal)
 Calculate the cross product with another normal.
 
int GetBufferAddress ()
 Get the buffer address for the normal data.
 
list GetList ()
 Get the normal as a list.
 

Detailed Description

FBNormal class.

A normal vector used to define the orientation of a surface. This class stores normal data as 3 float values (x, y, z).

Warning
Slicing is not supported by this object.

Constructor & Destructor Documentation

◆ FBNormal() [1/5]

◆ FBNormal() [2/5]

FBNormal ( FBNormal pNormal)

Copy constructor.

Parameters
pNormalNormal to copy.

References FBNormal().

◆ FBNormal() [3/5]

FBNormal ( float pX,
float pY,
float pZ )

Constructor from components.

Parameters
pXX component.
pYY component.
pZZ component.

◆ FBNormal() [4/5]

FBNormal ( object pObject)

Constructor from a Python object with indexing support.

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

◆ FBNormal() [5/5]

FBNormal ( list pList)

Constructor from list.

Parameters
pListList of 3 or 4 float values.

Member Function Documentation

◆ __add__() [1/2]

FBNormal __add__ ( FBNormal pNormal)

Addition operator with another normal.

Corresponds to python: n1 + n2

Parameters
pNormalNormal to add.
Returns
A new FBNormal with the result.

References FBNormal().

◆ __add__() [2/2]

FBNormal __add__ ( float pScalar)

Addition operator with a scalar.

Corresponds to python: n + 2.0

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

References FBNormal().

◆ __div__() [1/2]

FBNormal __div__ ( FBNormal pNormal)

Division operator with another normal (component-wise).

Corresponds to python: n1 / n2

Parameters
pNormalNormal to divide by.
Returns
A new FBNormal with the result.

References FBNormal().

◆ __div__() [2/2]

FBNormal __div__ ( float pScalar)

Division operator with a scalar.

Corresponds to python: n / 2.0

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

References FBNormal().

◆ __getitem__()

float __getitem__ ( int pIndex)

Returns the ith component.

Corresponds to python: print n[1]

Parameters
pIndexIndex of the component to get (0 to 2).
Returns
Normal component value.

◆ __iadd__() [1/2]

FBNormal __iadd__ ( FBNormal pNormal)

In-place addition with another normal.

Corresponds to python: n1 += n2

Parameters
pNormalNormal to add.
Returns
Self.

References FBNormal().

◆ __iadd__() [2/2]

FBNormal __iadd__ ( float pScalar)

In-place addition with a scalar.

Corresponds to python: n += 2.0

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

References FBNormal().

◆ __idiv__() [1/2]

FBNormal __idiv__ ( FBNormal pNormal)

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

Corresponds to python: n1 /= n2

Parameters
pNormalNormal to divide by.
Returns
Self.

References FBNormal().

◆ __idiv__() [2/2]

FBNormal __idiv__ ( float pScalar)

In-place division with a scalar.

Corresponds to python: n /= 2.0

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

References FBNormal().

◆ __imul__() [1/2]

FBNormal __imul__ ( FBNormal pNormal)

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

Corresponds to python: n1 *= n2

Parameters
pNormalNormal to multiply.
Returns
Self.

References FBNormal().

◆ __imul__() [2/2]

FBNormal __imul__ ( float pScalar)

In-place multiplication with a scalar.

Corresponds to python: n *= 2.0

Parameters
pScalarScalar value to multiply each component.
Returns
Self.

References FBNormal().

◆ __isub__() [1/2]

FBNormal __isub__ ( FBNormal pNormal)

In-place subtraction with another normal.

Corresponds to python: n1 -= n2

Parameters
pNormalNormal to subtract.
Returns
Self.

References FBNormal().

◆ __isub__() [2/2]

FBNormal __isub__ ( float pScalar)

In-place subtraction with a scalar.

Corresponds to python: n -= 2.0

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

References FBNormal().

◆ __len__()

int __len__ ( )

Returns the number of elements.

Corresponds to python: len(object)

Returns
Number of elements (3).

◆ __mul__() [1/2]

FBNormal __mul__ ( FBNormal pNormal)

Multiplication operator with another normal (component-wise).

Corresponds to python: n1 * n2

Parameters
pNormalNormal to multiply.
Returns
A new FBNormal with the result.

References FBNormal().

◆ __mul__() [2/2]

FBNormal __mul__ ( float pScalar)

Multiplication operator with a scalar.

Corresponds to python: n * 2.0

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

References FBNormal().

◆ __neg__()

FBNormal __neg__ ( )

Unary negation operator.

Corresponds to python: -n

Returns
A new FBNormal with negated components.

References FBNormal().

◆ __repr__()

str __repr__ ( )

Representation for debugging.

Corresponds to python: repr(n)

Returns
String representation for debugging.

◆ __setitem__()

void __setitem__ ( int pIndex,
float pValue )

Sets the ith component.

Corresponds to python: n[1] = 0.5

Parameters
pIndexIndex of the component to set (0 to 2).
pValueValue of the normal component.

◆ __str__()

str __str__ ( )

String representation.

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

Returns
String representation of the normal.

◆ __sub__() [1/2]

FBNormal __sub__ ( FBNormal pNormal)

Subtraction operator with another normal.

Corresponds to python: n1 - n2

Parameters
pNormalNormal to subtract.
Returns
A new FBNormal with the result.

References FBNormal().

◆ __sub__() [2/2]

FBNormal __sub__ ( float pScalar)

Subtraction operator with a scalar.

Corresponds to python: n - 2.0

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

References FBNormal().

◆ CopyFrom() [1/2]

FBNormal CopyFrom ( FBNormal pNormal)

Copy values from another normal.

Parameters
pNormalNormal to copy from.
Returns
A new FBNormal with copied values.

References FBNormal().

◆ CopyFrom() [2/2]

FBNormal CopyFrom ( list pList)

Copy values from a list.

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

References FBNormal().

◆ CrossProduct()

FBNormal CrossProduct ( FBNormal pNormal)

Calculate the cross product with another normal.

Parameters
pNormalNormal to calculate cross product with.
Returns
A new FBNormal representing the cross product.

References FBNormal().

◆ DotProduct()

float DotProduct ( FBNormal pNormal)

Calculate the dot product with another normal.

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

References FBNormal().

◆ GetBufferAddress()

int GetBufferAddress ( )

Get the buffer address for the normal data.

Returns
Buffer address as an integer.

◆ GetList()

list GetList ( )

Get the normal as a list.

Returns
List of 4 float values.

◆ IsEqual()

bool IsEqual ( FBNormal pNormal)

Compare for equality.

Parameters
pNormalNormal to compare with.
Returns
True if normals are equal.

References FBNormal().

◆ Length()

float Length ( )

Get the length (magnitude) of the normal.

Returns
The length of the normal vector.

◆ Normalize()

FBNormal Normalize ( )

Normalize the vector (make it unit length).

Returns
A new normalized FBNormal.

References FBNormal().

◆ NotEqual()

bool NotEqual ( FBNormal pNormal)

Compare for inequality.

Parameters
pNormalNormal to compare with.
Returns
True if normals are not equal.

References FBNormal().

◆ SquareLength()

float SquareLength ( )

Get the squared length of the normal.

More efficient than Length() when only comparing magnitudes.

Returns
The squared length of the normal vector.