Class SoMFVec3f
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();
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.fields.SoField
SoField.FieldTypes
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
ConstructorsConstructorDescriptionSoMFVec3f
(SoFieldContainer fieldContainer, String fieldName, SoField.FieldTypes fieldType) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Temporary disable value deleting.boolean
int
Calls find(targetValue, false).int
Finds the given targetValue in the array and returns the index of that value.void
Indicates that batch edits have finished.getDirectValues
(int start) Returns a pointer into the array of values in the field, starting at index start.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
Sets one value from double precision vector.void
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
Sets to one value from double precision vector.void
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.void
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, com.openinventor.inventor.SbVec3d[])
instead.void
Sets values from array of double precision vectors.void
Sets num values starting at index start to the values.void
setValuesBuffer
(ByteBuffer userData) Sets the field to contain the values stored in userData.Returns a pointer to the internally maintained array that can be modified.Methods inherited from class com.openinventor.inventor.fields.SoMField
deleteValues, deleteValues, get1, getNum, insertSpace, set1, setNum
Methods inherited from class com.openinventor.inventor.fields.SoField
appendConnection, appendConnection, connectFrom, connectFrom, disconnect, disconnect, disconnect, enableConnection, get, getConnectedEngine, getConnectedField, getContainer, getNumConnections, getValueSize, isConnected, isConnectedFromEngine, isConnectedFromField, isConnectedFromVRMLInterp, isConnectionEnabled, isDefault, isIgnored, set, setIgnored, touch
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoMFVec3f
Default constructor.
-
-
Method Details
-
setValues
public void setValues(int start, float[][] xyz) Sets values starting at index start to the vectors defined by xyz array. The private array will automatically be made larger to accommodate the new values, if necessary.- Parameters:
xyz
- array of arrays of 3 floats
-
setValues
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, float[])
instead.Sets values from array of arrays of 3 floats. -
setValues
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, com.openinventor.inventor.SbVec3d[])
instead.Sets values from array of double precision vectors. -
find
Calls find(targetValue, false). -
getDirectValues
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()
/finishEditing() methods for a way of modifying values in place. -
setValues
Sets num values starting at index start to the values. in newValues. The array will automatically be made larger to accommodate the new values, if necessary. In that case, if field's values are stored in an user data array, this array is no more used. -
find
Finds the given targetValue in the array and returns the index of that value. in the array. If the value is not found, -1 is returned. If addIfNotFound is set, then targetValue is added to the end of the array (but -1 is still returned). -
getValues
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()
/finishEditing() methods for a way of modifying values in place. -
getValueAt
-
set1Value
public void set1Value(int index, float[] xyz) Sets one value from 3 floats in array. -
setValue
public void setValue(float x, float y, float z) Sets to one value from 3 floats. -
finishEditing
public void finishEditing()Indicates that batch edits have finished. SeestartEditing()
. -
startEditing
Returns a pointer to the internally maintained array that can be modified. The values in the array may be changed, but values cannot be added or removed. It is illegal to call any other editing methods betweenstartEditing()
andfinishEditing()
(e.g.set1Value()
,setValue()
, etc.). Fields, engines or sensors connected to this field and sensors are not notified that this field has changed untilfinishEditing()
is called. CallingfinishEditing()
always sets theisDefault()
flag to false and informs engines and sensors that the field changed, even if none of the values actually were changed. -
set1Value
Sets the index'th value in the array to newValue. The array will be automatically expanded, if necessary. In that case, if field's values are stored in an user data array, this array is no more used. -
setValuesBuffer
Sets the field to contain the values stored in userData. This data will not be copied into the field: it will be directly used by the field. -
setValues
public void setValues(int start, float[] xyz) Sets values from the specified array of floats. The size of the array must be a multiple of 3. -
setValue
Sets to one value from double precision vector. -
setValues
Sets values from array of double precision vectors. -
set1Value
Sets one value from double precision vector. -
set1Value
public void set1Value(int index, float x, float y, float z) Sets one value from 3 floats. -
setValue
Sets the first value in the array to newValue, and deletes. the second and subsequent values. If field's values are stored in an user data array, this array is no more used. -
equals
-
disableDeleteValues
public void disableDeleteValues()Temporary disable value deleting. -
setValue
public void setValue(float[] xyz) Sets to one value from 3 floats in array.
-
setValues(int, float[])
instead.