---
name: "SoFloatElement"
section: "3"
platform: "linux"
package: "coin"
version: "1:4.0.10-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/SoFloatElement"
---

# SoFloatElement(3)

SoFloatElement is an abstract base class for elements that consists of a single float value.

## NAME

SoFloatElement - **SoFloatElement** is an abstract base class for elements that consists of a single float value.

## SYNOPSIS

\#include \<Inventor/elements/SoFloatElement.h\>

Inherits **SoElement**.

Inherited by **SoComplexityElement**, **SoCreaseAngleElement**, **SoDecimationPercentageElement**, **SoFocalDistanceElement**, **SoFontSizeElement**, **SoLineWidthElement**, **SoListenerGainElement**, **SoPointSizeElement**, and **SoTextureQualityElement**.

### Public Member Functions

virtual void **init** (**SoState** \*state)\
 virtual SbBool **matches** (const **SoElement** \*element) const\
 virtual **SoElement** \* **copyMatchInfo** (void) const\
 virtual void **print** (FILE \*file) const\
 virtual void **setElt** (float value)\

Public Member Functions inherited from **SoElement** const **SoType** **getTypeId** (void) const\
 int **getStackIndex** (void) const\
 virtual void **push** (**SoState** \*state)\
 virtual void **pop** (**SoState** \*state, const **SoElement** \*prevTopElement)\
 void **setDepth** (const int **depth**)\
 int **getDepth** (void) const\
 virtual **~SoElement** ()\

### Static Public Member Functions

static **SoType** **getClassTypeId** (void)\
 static int **getClassStackIndex** (void)\
 static void **initClass** (void)\
 static void **set** (const int **stackIndex**, **SoState** \*const state, **SoNode** \*const node, const float value)\
 static void **set** (const int **stackIndex**, **SoState** \*const state, const float value)\
 static float **get** (const int **stackIndex**, **SoState** \*const state)\

Static Public Member Functions inherited from **SoElement** static void **initClass** (void)\
 static **SoType** **getClassTypeId** (void)\
 static int **getClassStackIndex** (void)\
 static void **initElements** (void)\
 static int **getNumStackIndices** (void)\
 static **SoType** **getIdFromStackIndex** (const int **stackIndex**)\

### Protected Member Functions

virtual **~SoFloatElement** ()\

Protected Member Functions inherited from **SoElement** **SoElement** (void)\
 void **capture** (**SoState** \*const state) const\
 virtual void **captureThis** (**SoState** \*state) const\
 void **setTypeId** (const **SoType** **typeId**)\
 void **setStackIndex** (const int index)\
 **SoElement** \* **getNextInStack** (void) const\
 **SoElement** \* **getNextFree** (void) const\

### Protected Attributes

float **data**\

Protected Attributes inherited from **SoElement** **SoType** **typeId**\
 int **stackIndex**\
 int **depth**\

### Additional Inherited Members

Static Protected Member Functions inherited from **SoElement** static **SoElement** \* **getElement** (**SoState** \*const state, const int **stackIndex**)\
 static const **SoElement** \* **getConstElement** (**SoState** \*const state, const int **stackIndex**)\
 static int **createStackIndex** (const **SoType** id)\

Static Protected Attributes inherited from **SoElement** static int **classStackIndex**\
 static **SoTypeList** \* **stackToType**\

## Detailed Description

**SoFloatElement** is an abstract base class for elements that consists of a single float value.

This is the superclass of elements where the new element data *replaces* the old data, and where the data the element stores is a simple single precision floating point value.

This element is like a convenient light-weight version of the **SoReplacedElement**. It differs from the **SoReplacedElement** in that the **set()** and **get()** methods are already implemented, since it is known that subclasses will still contain just a single float value.

**See also**

**SoReplacedElement**, **SoInt32Element**, **SoAccumulatedElement**

## Constructor & Destructor Documentation

### SoFloatElement::~SoFloatElement (void ) \[protected\], \[virtual\]

Destructor.

## Member Function Documentation

### SoType SoFloatElement::getClassTypeId (void ) \[static\]

This static method returns the **SoType** object associated with objects of this class.

### int SoFloatElement::getClassStackIndex (void ) \[static\]

This static method returns the state stack index for the class.

### void SoFloatElement::initClass (void ) \[static\]

Initialize relevant common data for all instances, like the type system.

### void SoFloatElement::init (SoState \* state) \[virtual\]

Initializes the element to its default value. The default value is 0.0.

Reimplemented from **SoElement**.

Reimplemented in **SoComplexityElement**, **SoCreaseAngleElement**, **SoDecimationPercentageElement**, **SoFocalDistanceElement**, **SoFontSizeElement**, **SoGLLineWidthElement**, **SoGLPointSizeElement**, **SoLineWidthElement**, **SoListenerGainElement**, **SoPointSizeElement**, and **SoTextureQualityElement**.

### SbBool SoFloatElement::matches (const SoElement \* element) const \[virtual\]

This function returns TRUE is the element matches another element (of the same class), with respect to cache validity.

If the application programmer's extension element has a **matches()** function, it should also have a **copyMatchInfo()** function.

Implements **SoElement**.

### SoElement \* SoFloatElement::copyMatchInfo (void ) const \[virtual\]

This function creates a copy of the element that contains enough information to enable the **matches()** function to work.

Used to help with scene graph traversal caching operations.

Implements **SoElement**.

### void SoFloatElement::print (FILE \* file) const \[virtual\]

This function is for printing element information, and is used mostly for debugging purposes.

Reimplemented from **SoElement**.

### void SoFloatElement::set (const int index, SoState \*const state, SoNode \*const node, const float value) \[static\]

Static method for setting the *value* of an element in the given *state* at the given stack *index*.

### void SoFloatElement::set (const int stackIndex, SoState \*const state, const float value) \[static\]

Static method for setting the *value* of an element in the given *state* at the given *stackIndex*.

### float SoFloatElement::get (const int index, SoState \*const state) \[static\]

Static method to fetch the value of the element of this type from the given *state* at the given stack *index*.

### void SoFloatElement::setElt (float value) \[virtual\]

Set element value.

Reimplemented in **SoGLLineWidthElement**, and **SoGLPointSizeElement**.

## Member Data Documentation

### float SoFloatElement::data \[protected\]

The floating point value of the element.

## Author

Generated automatically by Doxygen for Coin from the source code.
