Package vrml.field
Class MFVec2f
java.lang.Object
vrml.Field
vrml.MField
vrml.field.MFVec2f
- All Implemented Interfaces:
Cloneable
VRML JSAI type class containing multiple vector2f fields.
Internally, the class stores the values as a single, flat array so that is the most efficient method to use to avoid reallocation. All methods make internal copies of the values.
- Version:
- $Revision: 1.8 $
- Author:
- Alan Hudson, Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
How much should we increment the array by when there is an add or insert request.protected float[]
The vec valuesFields inherited from class vrml.MField
numElements
Fields inherited from class vrml.Field
valueChanged
-
Constructor Summary
ConstructorsConstructorDescriptionMFVec2f()
Construct a new empty vector.MFVec2f
(float[] vec2s) Construct a new vector array based on all the given values.MFVec2f
(float[][] vec2s) Construct a new vector array based on all the given values.MFVec2f
(int size, float[] vec2s) Construct a new vector array based on a fraction of the items supplied. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(float x, float y) Append the components as a new vector value to the end of this field.void
addValue
(ConstSFVec2f vec) Append the field as a new vec value to the end of this field.void
Append the field as a new vec value to the end of this field.void
clear()
Clear the field of all elementsclone()
Make a clone of this object.void
delete
(int index) Remove the element at the given position and shift any other items down.void
get1Value
(int index, float[] vec2s) Copy the value of the vector at the given index into the user array.void
Copy the vector value at the given index into the supplied field.void
getValue
(float[] vec2s) Copy the value of this field into the given flat array.void
getValue
(float[][] vec2s) Copy the values from this field into the given array.void
insertValue
(int index, float x, float y) Insert the vector represented by the components at the given position in the array.void
insertValue
(int index, ConstSFVec2f vec) Insert the vector represented by the given field at the given position in the array.void
insertValue
(int index, SFVec2f vec) Insert the vector represented by the given field at the given position in the array.void
set1Value
(int index, float x, float y) Set the element at the given index with the given vec components.void
set1Value
(int index, ConstSFVec2f vec) Set the element at the given index with the value from the given field.void
Set the element at the given index with the value from the given field.void
setValue
(float[] vec2s) Set the field to the new values.void
setValue
(float[][] vec2s) Set the field to the new values.void
setValue
(int size, float[] vec2s) Set the value of this field given limited array of vecs.void
setValue
(ConstMFVec2f vecs) Set the value of this field to the values in the given field.void
Set the value of this field based on the values in the given field.toString()
Create a string representation of the field values.
-
Field Details
-
ARRAY_INC
protected static final int ARRAY_INCHow much should we increment the array by when there is an add or insert request. This value is array items, not elements.- See Also:
-
data
protected float[] dataThe vec values
-
-
Constructor Details
-
MFVec2f
public MFVec2f()Construct a new empty vector. -
MFVec2f
public MFVec2f(float[][] vec2s) Construct a new vector array based on all the given values.- Parameters:
vec2s
- The source vector values
-
MFVec2f
public MFVec2f(float[] vec2s) Construct a new vector array based on all the given values.- Parameters:
vec2s
- The source vector values
-
MFVec2f
public MFVec2f(int size, float[] vec2s) Construct a new vector array based on a fraction of the items supplied.- Parameters:
size
- The number of vectors is size / 2.vec2s
- The source vector values
-
-
Method Details
-
getValue
public void getValue(float[][] vec2s) Copy the values from this field into the given array.- Parameters:
vec2s
- The target array to copy values into
-
getValue
public void getValue(float[] vec2s) Copy the value of this field into the given flat array.- Parameters:
vec2s
- The target array to copy values into
-
get1Value
public void get1Value(int index, float[] vec2s) Copy the value of the vector at the given index into the user array.- Parameters:
index
- The index in the array of values to readvec2s
- The array to copy the vector value to
-
get1Value
Copy the vector value at the given index into the supplied field.- Parameters:
index
- The index in the array of values to readvec
- The field to copy the vector value to
-
setValue
public void setValue(float[][] vec2s) Set the field to the new values.- Parameters:
vec2s
- The new vec values to use
-
setValue
public void setValue(float[] vec2s) Set the field to the new values.- Parameters:
vec2s
- The new vec values to use
-
setValue
public void setValue(int size, float[] vec2s) Set the value of this field given limited array of vecs. x1, y1, z1, x2, y2, z2, ....- Parameters:
size
- The number of vecs is size / 2.vec2s
- Color triplicates flattened.
-
setValue
Set the value of this field based on the values in the given field.- Parameters:
vecs
- The field to copy from
-
setValue
Set the value of this field to the values in the given field.- Parameters:
vecs
- The field to copy from
-
set1Value
Set the element at the given index with the value from the given field.- Parameters:
index
- The index of the element to setvec
- The field to copy the data from
-
set1Value
Set the element at the given index with the value from the given field.- Parameters:
index
- The index of the element to setvec
- The field to copy the data from
-
set1Value
public void set1Value(int index, float x, float y) Set the element at the given index with the given vec components.- Parameters:
index
- The index of the element to setx
- The x component to usey
- The y component to use
-
addValue
Append the field as a new vec value to the end of this field.- Parameters:
vec
- The field to append
-
addValue
Append the field as a new vec value to the end of this field.- Parameters:
vec
- The field to append
-
addValue
public void addValue(float x, float y) Append the components as a new vector value to the end of this field.- Parameters:
x
- The x component to usey
- The y component to use
-
insertValue
Insert the vector represented by the given field at the given position in the array.- Parameters:
index
- The position to insert the valuevec
- The vec field to insert
-
insertValue
Insert the vector represented by the given field at the given position in the array.- Parameters:
index
- The position to insert the valuevec
- The vec field to insert
-
insertValue
public void insertValue(int index, float x, float y) Insert the vector represented by the components at the given position in the array.- Parameters:
index
- The position to insert the valuex
- The x component to usey
- The y component to use
-
clear
-
delete
-
toString
-
clone
-