Coin
4.0.3
Coin3D core library
|
The SbVec3f class is a 3 dimensional vector with floating point coordinates. More...
#include <Inventor/SbVec3f.h>
Protected Attributes | |
float | vec [3] |
Related Symbols | |
(Note that these are not member symbols.) | |
int | operator!= (const SbVec3f &v1, const SbVec3f &v2) |
SbVec3f | operator* (const SbVec3f &v, float d) |
SbVec3f | operator* (float d, const SbVec3f &v) |
SbVec3f | operator+ (const SbVec3f &v1, const SbVec3f &v2) |
SbVec3f | operator- (const SbVec3f &v1, const SbVec3f &v2) |
SbVec3f | operator/ (const SbVec3f &v, float d) |
int | operator== (const SbVec3f &v1, const SbVec3f &v2) |
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
This vector class is used by many other classes in Coin. It provides storage for a 3 dimensional vector as well as simple floating point arithmetic operations.
|
inline |
The default constructor does nothing. The vector coordinates will be uninitialized until you do a setValue() call.
|
inline |
Constructs an SbVec3f instance with initial values from v.
|
inline |
Constructs an SbVec3f instance with the initial vector endpoint set to <x,y,z>.
Constructs an SbVec3f instance by combining the three given planes. None of the planes should be parallel to any of the other two, otherwise a divide by zero error will occur.
Returns the result of taking the cross product of this vector and v.
Calculates and returns the result of taking the dot product of this vector and v.
Compares the vector with v and returns TRUE
if the distance between the vectors is smaller or equal to the square root of tolerance.
Convert from a string representation, return whether this is a valid conversion
Return the vector representing the principal axis closest to this vector.
|
inline |
Returns the x, y and z coordinates of the vector.
Returns a pointer to an array of three floats containing the x, y and z coordinates of the vector.
float SbVec3f::length | ( | void | ) | const |
Return length of vector.
float SbVec3f::normalize | ( | void | ) |
Normalize the vector to unit length. Return value is the original length of the vector before normalization.
If the vector is the null vector, no attempt at normalization will be done. If the Coin library was built in a debug version, and the COIN_DEBUG_NORMALIZE environment variable is set, this error message will then be shown:
Coin warning in SbVec3f::normalize(): The length of the vector should be > 0.0f to be able to normalize.
We've made it possible for Coin to spit out a warning when an attempt at normalizing a null-vector is made, as that seems to sometimes be a symptom caused by some graver error somewhere else – either an internal error in Coin code, a programming error in application code, or an error in an input file (like for instance invalid polygon specifications).
If you run into bugs/problems with your application or with Coin, it could be a good idea to set COIN_DEBUG_NORMALIZE=1, and then restart the application to see if you get any warnings from normalize().
If this happens, you should run the application in a debugger and see how the call-stack backtrace looks when it hits. An easy way of getting a debugger break at the warning spot is to set the following debugging environment variable which will make the code assert:
COIN_DEBUG_BREAK="SbVec3f::normalize"
If you from the backtrace analysis strongly suspects an internal Coin bug, please report the call-stack to us at coin-.nosp@m.supp.nosp@m.ort@c.nosp@m.oin3.nosp@m.d.org and we'll look into it. Example code that triggers the bug would then also be very helpful.
A note for developers porting code from SGI or TGS Inventor to Coin: those Inventor implementations are more slack about detecting and giving out warning messages upon API misuses, and you may suddenly have gotten this warning with Coin without seeing any indication of an error with SGI/TGS Inventor. This does not necessarily mean that it is a bug in Coin – it is much more likely that you are getting a warning as an indication of API misuse or import file errors which were just not detected and/or reported with those Inventor implementations.
|
inline |
Multiply components of vector with scalar value d. Returns reference to self.
Adds this vector and vector u. Returns reference to self.
Subtracts vector u from this vector. Returns reference to self.
|
inline |
Divides components of vector with scalar value d. Returns reference to self.
|
inline |
Index operator. Returns modifiable x, y or z coordinate of vector.
|
inline |
Index operator. Returns x, y or z coordinate of vector.
Dump the state of this object to the fp file stream. Only works in debug version of library, method does nothing in an optimized build.
Set new coordinates for the vector from v. Returns reference to self.
Sets this vector to the double precision vector v, converting the vector to a single precision vector.
This is a Coin extension.
SbVec3f & SbVec3f::setValue | ( | const SbVec3f & | barycentric, |
const SbVec3f & | v0, | ||
const SbVec3f & | v1, | ||
const SbVec3f & | v2 ) |
Set this vector to be the average of v0, v1 and v2. The vector components are weighted by the barycentric vector.
|
inline |
Set new coordinates for the vector. Returns reference to self.
|
inline |
Returns the squared length of the vector.
SbString SbVec3f::toString | ( | ) | const |
Return a string representation of this object
Returns 1 if v1 and v2 are not equal, 0 if they are equal.
Returns an SbVec3f instance which is the components of vector v multiplied with d.
Returns an SbVec3f instance which is the components of vector v multiplied with d.
Returns an SbVec3f instance which is the sum of vectors v1 and v2.
Returns an SbVec3f instance which is vector v2 subtracted from vector v1.
Returns an SbVec3f instance which is the components of vector v divided on the scalar factor d.
Returns 1 if v1 and v2 are exactly equal, 0 otherwise.
|
protected |
The container for all values of this class.