public class SoMFVec3f extends SoMField
SoMFVec3fs are written to file as one or more triples of floating point values separated by whitespace.
When more than one value is present, all of the values are enclosed in square brackets and separated by commas; for example:
[ 0 0 0, 1.2 3.4 5.6, 98.6 -4e1 212 ]
Using the setValues()
method:
Note: If you use the setValues()
method to set a larger number of values than the field currently contains, Open Inventor will automatically allocate more memory. The total number of values in the field is increased as expected. However the converse is not true. If you use setValues()
to set a
smaller number of values than the field currently contains, you are simply overriding some of the values in the field. The total number of values in the field does
not change. If you want to replace the current contents of the field with a smaller number of values, first call setNum( 0 ), then call setValues()
.
Using an Application-Supplied Array
The setValuesBuffer() methods allow Open Inventor to directly use an array of values supplied by the application. The application data is not copied.
When using application data directly the values may be modified by changing the application memory and calling touch()
to notify Open Inventor of the change. The values may also be modified using the usual methods (set1Value()
, etc.)
However, note that some methods (setNum()
, deleteValues()
, insertSpace()
, setValues()
, set1Value()
, setValue()
) may force Open Inventor to allocate a larger block of memory to hold all the values. In this case, Open Inventor will allocate memory internally and copy the data. Modifying values in the application memory will not affect the field if Open Inventor has allocated new memory.
Example:
// Allocate memory for vertices int numBytes = NUM_VERTICES * 4; ByteBuffer vertexBuffer = ByteBuffer.allocateDirect( numBytes ); vertexBuffer.order( ByteOrder.nativeOrder() ); FloatBuffer vertexFBuffer = vertexBuffer.asFloatBuffer(); // Assign values to the vertices (application-specific code) // . . . // Set the field's value to vertices in application memory SoVertexProperty vertexProperty = new SoVertexProperty(); vertexProperty.vertex.setValuesBuffer( vertexBuffer ); // Change application data and notify Open Inventor vertexFBuffer.put( 4, 2.0f ); vertexProperty.vertex.touch();
SoField.FieldTypes
Inventor.ConstructorCommand
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoMFVec3f(SoFieldContainer fieldContainer,
java.lang.String fieldName,
SoField.FieldTypes fieldType)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
disableDeleteValues()
Temporary disable value deleting.
|
boolean |
equals(java.lang.Object obj) |
int |
find(SbVec3f targetValue)
Calls find(targetValue, false).
|
int |
find(SbVec3f targetValue,
boolean addIfNotFound)
Finds the given
targetValue in the array and returns the index of that value.
|
void |
finishEditing()
Indicates that batch edits have finished.
|
java.nio.FloatBuffer |
getDirectValues(int start)
Returns a pointer into the array of values in the field, starting at index start.
|
SbVec3f |
getValueAt(int i) |
SbVec3f[] |
getValues(int start)
Returns a pointer into the array of values in the field, starting at index start.
|
void |
set1Value(int index,
float[] xyz)
Sets one value from 3 floats in array.
|
void |
set1Value(int index,
float x,
float y,
float z)
Sets one value from 3 floats.
|
void |
set1Value(int index,
SbVec3d vec3d)
Sets one value from double precision vector.
|
void |
set1Value(int index,
SbVec3f newValue)
Sets the
index'th value in the array to
newValue.
|
void |
setValue(float[] xyz)
Sets to one value from 3 floats in array.
|
void |
setValue(float x,
float y,
float z)
Sets to one value from 3 floats.
|
void |
setValue(SbVec3d vec3d)
Sets to one value from double precision vector.
|
void |
setValue(SbVec3f newValue)
Sets the first value in the array to
newValue, and deletes.
|
void |
setValues(int start,
float[] xyz)
Sets values from the specified array of floats.
|
void |
setValues(int start,
float[][] xyz)
Sets values starting at index start to the vectors defined by xyz array.
|
void |
setValues(int start,
int num,
float[] xyz)
Deprecated.
As of Open Inventor 9.3.1, use
setValues(int, float[])
instead. |
void |
setValues(int start,
int num,
SbVec3d[] vec3d)
Deprecated.
As of Open Inventor 9.3.1, use
setValues(int, com.openinventor.inventor.SbVec3d[])
instead. |
void |
setValues(int start,
SbVec3d[] vec3d)
Sets values from array of double precision vectors.
|
void |
setValues(int start,
SbVec3f[] newValues)
Sets
num values starting at index
start to the values.
|
void |
setValuesBuffer(java.nio.ByteBuffer userData)
Sets the field to contain the values stored in
userData.
|
java.nio.FloatBuffer |
startEditing()
Returns a pointer to the internally maintained array that can be modified.
|
deleteValues, deleteValues, get1, getNum, insertSpace, set1, setNum
appendConnection, appendConnection, connectFrom, connectFrom, disconnect, disconnect, disconnect, enableConnection, get, getConnectedEngine, getConnectedField, getContainer, getNumConnections, getValueSize, isConnected, isConnectedFromEngine, isConnectedFromField, isConnectedFromVRMLInterp, isConnectionEnabled, isDefault, isIgnored, set, setIgnored, touch
dispose, getNativeResourceHandle
public SoMFVec3f(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
public void setValues(int start, float[][] xyz)
xyz
- array of arrays of 3 floatspublic void setValues(int start, int num, float[] xyz)
setValues(int, float[])
instead.public void setValues(int start, int num, SbVec3d[] vec3d)
setValues(int, com.openinventor.inventor.SbVec3d[])
instead.public int find(SbVec3f targetValue)
public java.nio.FloatBuffer getDirectValues(int start)
startEditing()
/finishEditing() methods for a way of modifying values in place.public void setValues(int start, SbVec3f[] newValues)
public int find(SbVec3f targetValue, boolean addIfNotFound)
public SbVec3f[] getValues(int start)
startEditing()
/finishEditing() methods for a way of modifying values in place.public SbVec3f getValueAt(int i)
public void set1Value(int index, float[] xyz)
public void setValue(float x, float y, float z)
public void finishEditing()
startEditing()
.public java.nio.FloatBuffer startEditing()
startEditing()
and finishEditing()
(e.g. set1Value()
, setValue()
, etc.). Fields, engines or sensors connected to this field and sensors are not notified that this field has changed until finishEditing()
is called. Calling finishEditing()
always sets the isDefault()
flag to false and informs engines and sensors that the field changed, even if none of the values actually were changed.public void set1Value(int index, SbVec3f newValue)
public void setValuesBuffer(java.nio.ByteBuffer userData)
public void setValues(int start, float[] xyz)
public void setValue(SbVec3d vec3d)
public void setValues(int start, SbVec3d[] vec3d)
public void set1Value(int index, SbVec3d vec3d)
public void set1Value(int index, float x, float y, float z)
public void setValue(SbVec3f newValue)
public void disableDeleteValues()
public void setValue(float[] xyz)
Generated on July 31, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com