Package ch.bailu.gtk.graphene
Class Vec3
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.graphene.Vec3
- All Implemented Interfaces:
PointerInterface
A structure capable of holding a vector with three dimensions: x, y, and z.
The contents of the #graphene_vec3_t structure are private and should
never be accessed directly.
The contents of the #graphene_vec3_t structure are private and should
never be accessed directly.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds each component of the two given vectors.static Vec3
Allocates a new #graphene_vec3_t structure.void
Computes the cross product of the two given vectors.void
Divides each component of the first operand @a by the corresponding
component of the second operand @b, and places the results into the
vector @res.float
Computes the dot product of the two given vectors.boolean
Checks whether the two given #graphene_vec3_t are equal.void
free()
Frees the resources allocated by @vstatic ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
float
getX()
Retrieves the first component of the given vector @v.void
Creates a #graphene_vec2_t that contains the first and second
components of the given #graphene_vec3_t.void
Creates a #graphene_vec3_t that contains the first two components of
the given #graphene_vec3_t, and the third component set to 0.void
Converts a #graphene_vec3_t in a #graphene_vec4_t using 0.0
as the value for the fourth component of the resulting vector.void
Converts a #graphene_vec3_t in a #graphene_vec4_t using 1.0
as the value for the fourth component of the resulting vector.void
Converts a #graphene_vec3_t in a #graphene_vec4_t using @w as
the value of the fourth component of the resulting vector.float
getY()
Retrieves the second component of the given vector @v.float
getZ()
Retrieves the third component of the given vector @v.init
(float x, float y, float z) Initializes a #graphene_vec3_t using the given values.initFromVec3
(Vec3 src) Initializes a #graphene_vec3_t with the values of another
#graphene_vec3_t.void
interpolate
(Vec3 v2, double factor, Vec3 res) Linearly interpolates @v1 and @v2 using the given @factor.float
length()
Retrieves the length of the given vector @v.void
Compares each component of the two given vectors and creates a
vector that contains the maximum values.void
Compares each component of the two given vectors and creates a
vector that contains the minimum values.void
Multiplies each component of the two given vectors.boolean
Compares the two given #graphene_vec3_t vectors and checks
whether their values are within the given @epsilon.void
Negates the given #graphene_vec3_t.void
Normalizes the given #graphene_vec3_t.static Vec3
one()
Provides a constant pointer to a vector with three components,
all sets to 1.void
Multiplies all components of the given vector with the given scalar @factor.void
Subtracts from each component of the first operand @a the
corresponding component of the second operand @b and places
each result into the components of @res.void
Copies the components of a #graphene_vec3_t into the given array.static Vec3
xAxis()
Provides a constant pointer to a vector with three components
with values set to (1, 0, 0).static Vec3
yAxis()
Provides a constant pointer to a vector with three components
with values set to (0, 1, 0).static Vec3
zAxis()
Provides a constant pointer to a vector with three components
with values set to (0, 0, 1).static Vec3
zero()
Provides a constant pointer to a vector with three components,
all sets to 0.Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Vec3
-
-
Method Details
-
getClassHandler
-
allocVec3
Allocates a new #graphene_vec3_t structure.
The contents of the returned structure are undefined.
Use graphene_vec3_init() to initialize the vector.- Returns:
- the newly allocated #graphene_vec3_t structure. Use graphene_vec3_free() to free the resources allocated by this function.
-
add
Adds each component of the two given vectors.- Parameters:
b
- a #graphene_vec3_tres
- return location for the resulting vector
-
cross
Computes the cross product of the two given vectors.- Parameters:
b
- a #graphene_vec3_tres
- return location for the resulting vector
-
divide
Divides each component of the first operand @a by the corresponding
component of the second operand @b, and places the results into the
vector @res.- Parameters:
b
- a #graphene_vec3_tres
- return location for the resulting vector
-
dot
Computes the dot product of the two given vectors.- Parameters:
b
- a #graphene_vec3_t- Returns:
- the value of the dot product
-
equal
Checks whether the two given #graphene_vec3_t are equal.- Parameters:
v2
- a #graphene_vec3_t- Returns:
- `true` if the two vectors are equal, and false otherwise
-
free
public void free()Frees the resources allocated by @v -
getX
public float getX()Retrieves the first component of the given vector @v.- Returns:
- the value of the first component of the vector
-
getXy
Creates a #graphene_vec2_t that contains the first and second
components of the given #graphene_vec3_t.- Parameters:
res
- return location for a #graphene_vec2_t
-
getXy0
Creates a #graphene_vec3_t that contains the first two components of
the given #graphene_vec3_t, and the third component set to 0.- Parameters:
res
- return location for a #graphene_vec3_t
-
getXyz0
Converts a #graphene_vec3_t in a #graphene_vec4_t using 0.0
as the value for the fourth component of the resulting vector.- Parameters:
res
- return location for the vector
-
getXyz1
Converts a #graphene_vec3_t in a #graphene_vec4_t using 1.0
as the value for the fourth component of the resulting vector.- Parameters:
res
- return location for the vector
-
getXyzw
Converts a #graphene_vec3_t in a #graphene_vec4_t using @w as
the value of the fourth component of the resulting vector.- Parameters:
w
- the value of the W componentres
- return location for the vector
-
getY
public float getY()Retrieves the second component of the given vector @v.- Returns:
- the value of the second component of the vector
-
getZ
public float getZ()Retrieves the third component of the given vector @v.- Returns:
- the value of the third component of the vector
-
init
Initializes a #graphene_vec3_t using the given values.
This function can be called multiple times.- Parameters:
x
- the X field of the vectory
- the Y field of the vectorz
- the Z field of the vector- Returns:
- a pointer to the initialized vector
-
initFromVec3
Initializes a #graphene_vec3_t with the values of another
#graphene_vec3_t.- Parameters:
src
- a #graphene_vec3_t- Returns:
- the initialized vector
-
interpolate
Linearly interpolates @v1 and @v2 using the given @factor.- Parameters:
v2
- a #graphene_vec3_tfactor
- the interpolation factorres
- the interpolated vector
-
length
public float length()Retrieves the length of the given vector @v.- Returns:
- the value of the length of the vector
-
max
Compares each component of the two given vectors and creates a
vector that contains the maximum values.- Parameters:
b
- a #graphene_vec3_tres
- return location for the result vector
-
min
Compares each component of the two given vectors and creates a
vector that contains the minimum values.- Parameters:
b
- a #graphene_vec3_tres
- return location for the result vector
-
multiply
Multiplies each component of the two given vectors.- Parameters:
b
- a #graphene_vec3_tres
- return location for the resulting vector
-
near
Compares the two given #graphene_vec3_t vectors and checks
whether their values are within the given @epsilon.- Parameters:
v2
- a #graphene_vec3_tepsilon
- the threshold between the two vectors- Returns:
- `true` if the two vectors are near each other
-
negate
Negates the given #graphene_vec3_t.- Parameters:
res
- return location for the result vector
-
normalize
Normalizes the given #graphene_vec3_t.- Parameters:
res
- return location for the normalized vector
-
scale
Multiplies all components of the given vector with the given scalar @factor.- Parameters:
factor
- the scalar factorres
- return location for the result vector
-
subtract
Subtracts from each component of the first operand @a the
corresponding component of the second operand @b and places
each result into the components of @res.- Parameters:
b
- a #graphene_vec3_tres
- return location for the resulting vector
-
toFloat
Copies the components of a #graphene_vec3_t into the given array.- Parameters:
dest
- return location for an array of floating point values
-
one
Provides a constant pointer to a vector with three components,
all sets to 1.- Returns:
- a constant vector
-
xAxis
Provides a constant pointer to a vector with three components
with values set to (1, 0, 0).- Returns:
- a constant vector
-
yAxis
Provides a constant pointer to a vector with three components
with values set to (0, 1, 0).- Returns:
- a constant vector
-
zAxis
Provides a constant pointer to a vector with three components
with values set to (0, 0, 1).- Returns:
- a constant vector
-
zero
Provides a constant pointer to a vector with three components,
all sets to 0.- Returns:
- a constant vector
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-