Class SoMFVec3f
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.fields.SoField
-
- com.openinventor.inventor.fields.SoMField
-
- com.openinventor.inventor.fields.SoMFVec3f
-
public class SoMFVec3f extends SoMField
Multiple-value field containing any number of three-dimensional vectors. A multiple-value field that contains any number of three-dimensional vectors.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 usesetValues()
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 callsetValues()
.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
Constructors Constructor Description SoMFVec3f(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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, usesetValues(int, float[])
instead.void
setValues(int start, int num, SbVec3d[] vec3d)
Deprecated.As of Open Inventor 9.3.1, usesetValues(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.-
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 Detail
-
SoMFVec3f
public SoMFVec3f(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
Default constructor.
-
-
Method Detail
-
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(since="9.3.1") public void setValues(int start, int num, float[] xyz)
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, float[])
instead.Sets values from array of arrays of 3 floats.
-
setValues
@Deprecated(since="9.3.1") public void setValues(int start, int num, SbVec3d[] vec3d)
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, com.openinventor.inventor.SbVec3d[])
instead.Sets values from array of double precision vectors.
-
find
public int find(SbVec3f targetValue)
Calls find(targetValue, false).
-
getDirectValues
public java.nio.FloatBuffer getDirectValues(int start)
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
public void setValues(int start, SbVec3f[] newValues)
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
public int find(SbVec3f targetValue, boolean addIfNotFound)
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
public SbVec3f[] getValues(int start)
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
public SbVec3f getValueAt(int i)
-
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
public java.nio.FloatBuffer 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
public void set1Value(int index, SbVec3f newValue)
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
public void setValuesBuffer(java.nio.ByteBuffer userData)
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
public void setValue(SbVec3d vec3d)
Sets to one value from double precision vector.
-
setValues
public void setValues(int start, SbVec3d[] vec3d)
Sets values from array of double precision vectors.
-
set1Value
public void set1Value(int index, SbVec3d vec3d)
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
public void setValue(SbVec3f newValue)
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.
-
disableDeleteValues
public void disableDeleteValues()
Temporary disable value deleting.
-
setValue
public void setValue(float[] xyz)
Sets to one value from 3 floats in array.
-
-