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

Vector2d class. More...

#include <pyfbsdk.h>

Public Member Functions

 FBVector2d ()
 Constructor.
 
 FBVector2d (FBVector2d pVector2d)
 Constructor.
 
 FBVector2d (float pX, float pY)
 Constructor.
 
 FBVector2d (tuple< float, float >)
 Constructor.
 
int __len__ ()
 Returns the number of elements.
 
float __getitem__ (int pIndex)
 Returns the ith component Corresponds to python: print v[1].
 
 __setitem__ (int pIndex, float pComponentValue)
 Sets the ith components Corresponds to python: v[1] = 0.5.
 
FBVector2d operator+ (FBVector2d pVector)
 Add 2 vectors.
 
FBVector2d operator- (FBVector2d pVector)
 Substract 2 vectors.
 

Detailed Description

Vector2d class.

This class creates a list like object, which can be modified using the list protocol method. But unlike lists, its length is fixed: it always contain 2 floating point values. Thus it does not support the any list methods that would affect its length. The values within can be changed, usually via the bracket operator.

# Supported list protocol methods:
color = FBColor()
len(color)
print color[0]
color[0] = 1.0
FBColor class.
Definition: pyfbsdk.h:516
Warning
Slicing is not supported by this object.

Constructor & Destructor Documentation

◆ FBVector2d() [1/4]

Constructor.

Default constructor, both values within are set to 0.0.

◆ FBVector2d() [2/4]

FBVector2d ( FBVector2d  pVector2d)

Constructor.

Copy constructor. Copy values from another instance.

◆ FBVector2d() [3/4]

FBVector2d ( float  pX,
float  pY 
)

Constructor.

Explicitely construct a vector by specifying its values.

◆ FBVector2d() [4/4]

Constructor.

A vector can be built from any python object with supports the tuple interface and is of a lenght of 2.

Member Function Documentation

◆ __getitem__()

float __getitem__ ( int  pIndex)

Returns the ith component Corresponds to python: print v[1].

Parameters
pIndexIndex of the components to get (0 to 1)
Returns
Color component value.

◆ __len__()

int __len__ ( )

Returns the number of elements.

Corresponds to python: len(object)

◆ __setitem__()

__setitem__ ( int  pIndex,
float  pComponentValue 
)

Sets the ith components Corresponds to python: v[1] = 0.5.

Parameters
pIndexIndex of the components to set (0 to 1)
pComponentValueValue of component to set

◆ operator+()

FBVector2d operator+ ( FBVector2d  pVector)

Add 2 vectors.

Parameters
pVectorVector to add to source.
Returns
The addition of both vectors.

◆ operator-()

FBVector2d operator- ( FBVector2d  pVector)

Substract 2 vectors.

Parameters
pVectorVector to add to source.
Returns
The substraction of both vectors.