Click or drag to resize
SoAlgebraicShape Class

Abstract base class for algebraic shapes.

Inheritance Hierarchy

Namespace: OIV.Inventor.Nodes
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 2024.2.0.0 (2024.2.0)
Syntax
public abstract class SoAlgebraicShape : SoShape

The SoAlgebraicShape type exposes the following members.

Methods
  NameDescription
Public methodAffectsState

Overrides default method on OIV.Inventor.Nodes.SoNode.

(Inherited from SoShape.)
Public methodBeginShape(SoAction, SoShapeTriangleShapes)
Calls BeginShape(action, shapeType, (OIV.Inventor.Details.SoFaceDetail ^)nullptr).
(Inherited from SoShape.)
Public methodBeginShape(SoAction, SoShapeTriangleShapes, SoFaceDetail)

These methods can be used by subclasses to generate triangles more easily when those triangles are part of a larger structure, such as a triangle strip, triangle fan, or triangulated polygon, according to the TriangleShape enumerated type.

(Inherited from SoShape.)
Public methodCallback

Implements primitive generation for all shapes.

(Inherited from SoShape.)
Public methodComputeBBox(SoAction, SbBox3f, SbVec3f)

OIV actions.

(Overrides SoShapeComputeBBox(SoAction, SbBox3f, SbVec3f).)
Public methodComputeBBox(SoAction, SbXfBox3d, SbVec3d)

Compute object oriented bounding box (OOB) for subclass using information in the given action (which may not necessarily be an OIV.Inventor.Actions.SoGetBoundingBoxAction).

(Inherited from SoShape.)
Public methodCopy
Calls Copy(false).
(Inherited from SoNode.)
Public methodCopy(Boolean)

Creates and returns an exact copy of the node.

(Inherited from SoNode.)
Public methodCopyFieldValues(SoFieldContainer)
Calls CopyFieldValues(fc, false).
(Inherited from SoFieldContainer.)
Public methodCopyFieldValues(SoFieldContainer, Boolean)

Copies the contents of fc's fields into this object's fields.

(Inherited from SoFieldContainer.)
Public methodDispose
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.)
Public methodDistribute
(Inherited from SoNode.)
Public methodDoAction
(Inherited from SoNode.)
Public methodEnableNotify

Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false).

(Inherited from SoFieldContainer.)
Public methodEndShape

end shape previously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail).

(Inherited from SoShape.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFieldsAreEqual

Returns true if this object's fields are exactly equal to fc's fields.

(Inherited from SoFieldContainer.)
Public methodGet

Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.

(Inherited from SoFieldContainer.)
Public methodGetAllFields

Returns a list of fields, including the eventIn's and eventOut's.

(Inherited from SoFieldContainer.)
Public methodGetAlternateRep

This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type).

(Inherited from SoNode.)
Public methodGetBoundingBox

Implements bounding box method using virtual OIV.Inventor.Nodes.SoShape.ComputeBBox(OIV.Inventor.Actions.SoAction, OIV.Inventor.SbBox3f@, OIV.Inventor.SbVec3f@) method.

(Inherited from SoShape.)
Public methodGetEventIn

Returns a the eventIn with the given name.

(Inherited from SoFieldContainer.)
Public methodGetEventOut

Returns the eventOut with the given name.

(Inherited from SoFieldContainer.)
Public methodGetField

Returns a the field of this object whose name is fieldName.

(Inherited from SoFieldContainer.)
Public methodGetFieldName

Returns the name of the given field in the fieldName argument.

(Inherited from SoFieldContainer.)
Public methodGetFields

Appends references to all of this object's fields to resultList, and returns the number of fields appended.

(Inherited from SoFieldContainer.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetMatrix
(Inherited from SoNode.)
Public methodGetName

Returns the name of an instance.

(Inherited from SoBase.)
Public methodGetPrimitiveCount

Counts number of primitives produced by this shape.

(Inherited from SoShape.)
Public methodGetRenderEngineMode

Returns the supported Render engine mode.

(Inherited from SoNode.)
Public methodGetRenderUnitID
(Inherited from SoNode.)
Public methodGetShapeType

Gets the current shape Full Scene Antialiasing type.

(Inherited from SoShape.)
Public methodGetStringName (Inherited from SoBase.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGLRender

OIV actions.

(Overrides SoShapeGLRender(SoGLRenderAction).)
Public methodGLRenderBelowPath
(Inherited from SoNode.)
Public methodGLRenderInPath
(Inherited from SoNode.)
Public methodGLRenderOffPath
(Inherited from SoNode.)
Public methodGrabEventsCleanup
(Inherited from SoNode.)
Public methodGrabEventsSetup
(Inherited from SoNode.)
Public methodHandleEvent
(Inherited from SoNode.)
Public methodHasDefaultValues

Returns true if all of the object's fields have their default values.

(Inherited from SoFieldContainer.)
Public methodIsBoundingBoxIgnoring

Used by BoundingBoxAction to know if bounding box computation should be ignored or not.

(Inherited from SoShape.)
Public methodIsNotifyEnabled

Notification is the process of telling interested objects that this object has changed.

(Inherited from SoFieldContainer.)
Public methodIsOverride

Returns the state of the override flag.

(Inherited from SoNode.)
Public methodIsSynchronizable

Gets the ScaleViz synchronizable state of this object.

(Inherited from SoBase.)
Public methodPick
(Inherited from SoNode.)
Public methodRayPick

Implements picking along a ray by intersecting the ray with each primitive generated by subclass.

(Inherited from SoShape.)
Public methodSearch
(Inherited from SoNode.)
Public methodSet

Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.

(Inherited from SoFieldContainer.)
Public methodSetName (Inherited from SoBase.)
Public methodSetOverride

Turns the override flag on or off.

(Inherited from SoNode.)
Public methodSetShapeType

set the antialiasing type for this shape.

(Inherited from SoShape.)
Public methodSetSynchronizable

Sets this to be a ScaleViz synchronizable object.

(Inherited from SoBase.)
Public methodSetToDefaults

Sets all fields in this object to their default values.

(Inherited from SoFieldContainer.)
Public methodShapeVertex

add a primitive vertex to the shape prevously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail).

(Inherited from SoShape.)
Public methodToString
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.)
Public methodTouch

Marks an instance as modified, simulating a change to it.

(Inherited from SoNode.)
Public methodWrite
(Inherited from SoNode.)
Top
Properties
  NameDescription
Public propertyboundingBoxIgnoring

Whether to ignore this node during bounding box traversal.

(Inherited from SoShape.)
Public propertygenerateTransparency

Specify if the shape generates transparent fragment.

Public propertyIsDisposable
ISafeDisposable interface implementation.
(Inherited from SoDisposable.)
Public propertyrayIntersection

Field for an OIV.Inventor.Nodes.SoFragmentShader object that defines the GLSL ray intersection function.

Public propertyshaderSlots

Multi-field for Shader slots of type OIV.Inventor.Nodes.SoShaderObject.

Public propertyUserData
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.)
Public propertyworkspace

Field to define the workspace.

Top
Remarks

An implicit surface is a 2-dimensional surface in 3-dimensional space defined as the locus of zeros of a given function. Many useful shapes such as sphere, cylinder or cone can be expressed using this approach, known as a quadric surfaces.

Sub-classes of this node compute and render an implicit surface on the GPU using a GLSL shader function. A screen-aligned quad is drawn, representing the screen space bounding box of the algebraic shape. Then, this quad is ray-casted and a ray/shape intersection is applied per fragment to draw the final shape.

Several predefined sub-classes are provided for convenience, including OIV.Inventor.Nodes.SoAlgebraicCone, OIV.Inventor.Nodes.SoAlgebraicCylinder and OIV.Inventor.Nodes.SoAlgebraicSphere. These nodes can be used in an application scene graph similar to the corresponding classic geometry nodes OIV.Inventor.Nodes.SoCone, OIV.Inventor.Nodes.SoCylinder and OIV.Inventor.Nodes.SoSphere. Use a transform node, e.g. OIV.Inventor.Nodes.SoTransform, to position the shape node in 3D space. Use an OIV.Inventor.Nodes.SoMaterial node to assign material properties. See the notes and limitations section on this page for some important differences between algebraic and geometric shapes.

Extending OIV.Inventor.Nodes.SoAlgebraicShape:

Derived classes must implement the bounding box computation function computeBBox() in C#.And also implement the ray/shape intersection function OivASRayIntersection() in GLSL. This function returns true if there is an intersection between the ray and the shape, false otherwise. Create an OIV.Inventor.Nodes.SoFragmentShader to hold the GLSL function and set this node in the rayIntersection field.

bool
OivASRayIntersection ( in OivASRay ray, inout OivASPoint point )
{
  DO SOMETHING
  return [ true | false ];
}

See the GLSL include file oivAlgebraicShape.h in $OIVHOME/shaders/include/Inventor/AlgebraicShape. It declares ray, a structure that contains ray parameters:

struct OivASRay {
 vec3 rs; // ray start
 vec3 re; // ray end
 vec3 rd; // ray direction
};
and point, an output structure containing position, normal and color (if any) of the intersection point.
struct OivASPoint {
 vec3 position;
 vec3 normal;
 vec4 color;
};

Note that ray parameters and point information are defined in the reference frame specified by the workspace field, an enum of type OIV.Inventor.Nodes.SoAlgebraicShape.ASWorkSpaces. This frame can be the camera space, the world space or the normalized space of the bounding box of the shape. By default, the bounding box space is used.

A GLSL helper function for solving quadratic functions (i.e. a*x^2 + b*x + c = 0) is provided:

bool OivASSolveQuadric ( in vec3 abc, inout vec2 roots );

with abc, a vector containing the coefficients {a, b, c} of the polynomial. A quadratic equation has zero, one or two solutions, called roots. It returns true if there are solutions, false otherwise. Note that only helper function for quadric surfaces are provided but higher order surface such as Torus (i.e. degree 4) may be implemented using user-defined polynomial solver.

All quadric shape equations can be solved using this function. For instance, the equation of a sphere centered at the origin with a radius of 1 is defined by: x^2 + y^2 + z^2 - 1 = 0 To find the intersection point between such a sphere with a ray as defined above, we have to solve the quadric sphere equation such as: (rs + t*rd)^2 - 1 = 0 which leads to, rd^2 . t^2 + 2 . rs . rd . t + rs^2 - 1 = 0 It means solving a quadratic equation with:

  • a = 1 (i.e. dot(rd, rd) = 1),

  • b = 2 * dot(rs, rd),

  • c = dot(rs, rs) - 1.0.

If a solution exists (1 or 2), the OivASSolveQuadric function returns true and roots are stored in the parameter roots. The roots (i.e. t1 and t2) represent the solution for the parameter t such as solutions are:

  • p1 = rs + t1*rd

  • p2 = rs + t2*rd

The smallest positive root is the first intersection point along the ray direction rd. If there are two positive roots, the larger one is the intersection point with the back face. If a root is negative, it means that there is an intersection in the opposite ray direction.

While this node is designed to address algebraic surfaces, the ray intersection function could be used with other types of surfaces to find the intersection between the ray and the shape (e.g. distance functions).

Note that this node supports instancing using OIV.Inventor.Nodes.SoMultipleInstance to render millions of algebraic shapes in a more efficient way than than using geometric shapes.

The application can also provide custom color shaders to shade the surface or use built-in shading based on light model and material properties (transparency is supported as well).

Notes:

Limitations:

See Also