# SbVec4f.3coin4 - Man Page

The SbVec4f class is a 4 dimensional vector with floating point coordinates.

## Synopsis

`#include <Inventor/SbVec4f.h>`

Inherited by SbColor4f.

### Public Member Functions

SbVec4f (void)
SbVec4f (const float v)
SbVec4f (float x, float y, float z, float w)
SbVec4f (const SbVec4d &v)
SbVec4f (const SbVec4b &v)
SbVec4f (const SbVec4s &v)
SbVec4f (const SbVec4i32 &v)
SbVec4f & setValue (const float v)
SbVec4f & setValue (float x, float y, float z, float w)
SbVec4f & setValue (const SbVec4d &v)
SbVec4f & setValue (const SbVec4b &v)
SbVec4f & setValue (const SbVec4s &v)
SbVec4f & setValue (const SbVec4i32 &v)
const float * getValue (void) const
void getValue (float &x, float &y, float &z, float &w) const
float & operator[] (int i)
const float & operator[] (int i) const
SbBool equals (const SbVec4f &v, float tolerance) const
float dot (const SbVec4f &v) const
void getReal (SbVec3f &v) const
float length (void) const
float sqrLength (void) const
void negate (void)
float normalize (void)
SbVec4f & operator*= (float d)
SbVec4f & operator/= (float d)
SbVec4f & operator+= (const SbVec4f &v)
SbVec4f & operator-= (const SbVec4f &v)
SbVec4f operator- (void) const
void print (FILE *fp) const

float vec 

## Detailed Description

The SbVec4f class is a 4 dimensional vector with floating point coordinates.

This vector class is used by many other classes in Coin. It provides storage for a 3 dimensional homogeneoues vector (with the 4 components usually referred to as <x, y, z, w>) as well as simple floating point arithmetic operations.

SbVec2s, SbVec2f, SbVec2d, SbVec3s, SbVec3f, SbVec3d, SbVec4d.

## Constructor & Destructor Documentation

### SbVec4f::SbVec4f (void) [inline]

The default constructor does nothing. The vector coordinates will be uninitialized until a call the setValue().

### SbVec4f::SbVec4f (const float v) [inline]

Constructs an SbVec4f instance with initial values from v.

### SbVec4f::SbVec4f (float x, float y, float z, float w) [inline]

Constructs an SbVec4f instance with the initial homogeneous vector set to <x,y,z,w>.

### SbVec4f::SbVec4f (const SbVec4d & v) [inline], [explicit]

Constructs an SbVec4f instance from an SbVec4d instance.

### SbVec4f::SbVec4f (const SbVec4b & v) [inline], [explicit]

Constructs an SbVec4f instance from an SbVec4b instance.

Since

Coin 2.5

### SbVec4f::SbVec4f (const SbVec4s & v) [inline], [explicit]

Constructs an SbVec4f instance from an SbVec4s instance.

Since

Coin 2.5

### SbVec4f::SbVec4f (const SbVec4i32 & v) [inline], [explicit]

Constructs an SbVec4f instance from an SbVec4i32 instance.

Since

Coin 2.5

## Member Function Documentation

### SbVec4f & SbVec4f::setValue (const float v) [inline]

Set new coordinates for the vector from v. Returns reference to self.

getValue().

### SbVec4f & SbVec4f::setValue (float x, float y, float z, float w) [inline]

Set new coordinates for the vector. Returns reference to self.

getValue().

### SbVec4f & SbVec4f::setValue (const SbVec4d & v)

Sets the value from an SbVec4d instance.

Since

Coin 2.5

Since

Coin 2.5

Since

Coin 2.5

### const float * SbVec4f::getValue (void) const [inline]

Returns a pointer to an array of four floats containing the x, y, z and w coordinates of the vector.

setValue().

### void SbVec4f::getValue (float & x, float & y, float & z, float & w) const [inline]

Returns the x, y, z and w coordinates of the vector.

setValue().

### float & SbVec4f::operator[] (int i) [inline]

Index operator. Returns modifiable x, y, z or w component of vector.

getValue() and setValue().

### const float & SbVec4f::operator[] (int i) const [inline]

Index operator. Returns x, y, z or w component of vector.

getValue() and setValue().

### SbBool SbVec4f::equals (const SbVec4f & v, float tolerance) const

Compares the vector with v and returns `TRUE` if the distance between the vectors is smaller or equal to the square root of tolerance.

The comparison is done in 4D-space, i.e. the w component of the vector is not used to make x, y and z into Cartesian coordinates first.

### float SbVec4f::dot (const SbVec4f & v) const [inline]

Calculates and returns the result of taking the dot product of this vector and v.

### void SbVec4f::getReal (SbVec3f & v) const

Returns the vector as a Cartesian 3D vector in v. This means that the 3 first components x, y and z will be divided by the fourth, w.

### float SbVec4f::length (void) const

Return the length of the vector in 4D space.

### float SbVec4f::sqrLength (void) const [inline]

Return the square of the length of the vector in 4D space.

### void SbVec4f::negate (void) [inline]

Negate the vector.

### float SbVec4f::normalize (void)

Normalize the vector to unit length. Return value is the original length of the vector before normalization.

### SbVec4f & SbVec4f::operator*= (float d) [inline]

Multiply components of vector with value d. Returns reference to self.

### SbVec4f & SbVec4f::operator/= (float d) [inline]

Divides components of vector with value d. Returns reference to self.

### SbVec4f & SbVec4f::operator+= (const SbVec4f & v) [inline]

Adds this vector and vector v. Returns reference to self.

### SbVec4f & SbVec4f::operator-= (const SbVec4f & v) [inline]

Subtracts vector v from this vector. Returns reference to self.

### SbVec4f SbVec4f::operator- (void) const [inline]

Non-destructive negation operator. Returns a new SbVec4f instance which has all components negated.

negate().

### void SbVec4f::print (FILE * fp) const

Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile.

## Author

Generated automatically by Doxygen for Coin from the source code.

## Info

Sat Aug 1 2020 Version 4.0.0 Coin
{"ft_lang_label":"__label__en","ft_lang_prob":0.50523865,"math_prob":0.9385463,"size":6383,"snap":"2020-45-2020-50","text_gpt3_token_len":2094,"char_repetition_ratio":0.27182943,"word_repetition_ratio":0.23326571,"special_character_ratio":0.26899576,"punctuation_ratio":0.15879828,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9893616,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-10-22T04:17:01Z\",\"WARC-Record-ID\":\"<urn:uuid:49d1c26f-00c9-48f4-b7ef-21e85f96e6d0>\",\"Content-Length\":\"31289\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:033eb112-c237-40b5-b5bb-c27dc1cbfe53>\",\"WARC-Concurrent-To\":\"<urn:uuid:15d7a142-38ae-4969-b1cf-c55591b2a6e1>\",\"WARC-IP-Address\":\"172.67.150.178\",\"WARC-Target-URI\":\"https://www.mankier.com/3/SbVec4f.3coin4\",\"WARC-Payload-Digest\":\"sha1:HTSGRJ3NTWT7FX2D737KGJ4PCNFURZMJ\",\"WARC-Block-Digest\":\"sha1:JLP3G5XZDTJPRJCT5MHI7E5Q7SYRGTLQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-45/CC-MAIN-2020-45_segments_1603107878879.33_warc_CC-MAIN-20201022024236-20201022054236-00289.warc.gz\"}"}