Package org.gnome.graphene
Class Point3D
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.graphene.Point3D
-
Constructor Summary
ConstructorDescriptionPoint3D()
Allocate a new Point3D.Point3D
(float x, float y, float z) Allocate a new Point3D with the fields set to the provided values.Allocate a new Point3D with the fields set to the provided values.Allocate a new Point3D.Point3D
(MemorySegment address) Create a Point3D proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionstatic Point3D
alloc()
Allocates agraphene_point3d_t
structure.void
Computes the cross product of the two givengraphene_point3d_t
.float
Computes the distance between the two givengraphene_point3d_t
.float
Computes the dot product of the two givengraphene_point3d_t
.boolean
Checks whether two given points are equal.void
free()
Frees the resources allocated via graphene_point3d_alloc().static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the Point3D classinit
(float x, float y, float z) Initializes agraphene_point3d_t
with the given coordinates.initFromPoint
(Point3D src) Initializes agraphene_point3d_t
using the coordinates of anothergraphene_point3d_t
.initFromVec3
(Vec3 v) Initializes agraphene_point3d_t
using the components of agraphene_vec3_t
.void
interpolate
(Point3D b, double factor, Point3D res) Linearly interpolates each component of this Point3D andb
using the providedfactor
, and places the result inres
.float
length()
Computes the length of the vector represented by the coordinates of the givengraphene_point3d_t
.boolean
Checks whether the two points are near each other, within anepsilon
factor.void
Computes the normalization of the vector represented by the coordinates of the givengraphene_point3d_t
.void
normalizeViewport
(Rect viewport, float zNear, float zFar, Point3D res) Normalizes the coordinates of agraphene_point3d_t
using the given viewport and clipping planes.float
readX()
Read the value of the fieldx
.float
readY()
Read the value of the fieldy
.float
readZ()
Read the value of the fieldz
.void
Scales the coordinates of the givengraphene_point3d_t
by the givenfactor
.void
Stores the coordinates of agraphene_point3d_t
into agraphene_vec3_t
.void
writeX
(float x) Write a value in the fieldx
.void
writeY
(float y) Write a value in the fieldy
.void
writeZ
(float z) Write a value in the fieldz
.static Point3D
zero()
Retrieves a constant point with all three coordinates set to 0.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Point3D
Create a Point3D proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Point3D
Allocate a new Point3D.- Parameters:
arena
- to control the memory allocation scope
-
Point3D
public Point3D()Allocate a new Point3D. The memory is allocated withArena.ofAuto()
. -
Point3D
Allocate a new Point3D with the fields set to the provided values.- Parameters:
x
- value for the fieldx
y
- value for the fieldy
z
- value for the fieldz
arena
- to control the memory allocation scope
-
Point3D
public Point3D(float x, float y, float z) Allocate a new Point3D with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
x
- value for the fieldx
y
- value for the fieldy
z
- value for the fieldz
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readX
public float readX()Read the value of the fieldx
.- Returns:
- The value of the field
x
-
writeX
public void writeX(float x) Write a value in the fieldx
.- Parameters:
x
- The new value for the fieldx
-
readY
public float readY()Read the value of the fieldy
.- Returns:
- The value of the field
y
-
writeY
public void writeY(float y) Write a value in the fieldy
.- Parameters:
y
- The new value for the fieldy
-
readZ
public float readZ()Read the value of the fieldz
.- Returns:
- The value of the field
z
-
writeZ
public void writeZ(float z) Write a value in the fieldz
.- Parameters:
z
- The new value for the fieldz
-
alloc
Allocates agraphene_point3d_t
structure.- Returns:
- the newly allocated structure. Use graphene_point3d_free() to free the resources allocated by this function.
-
zero
Retrieves a constant point with all three coordinates set to 0.- Returns:
- a zero point
-
cross
-
distance
-
dot
Computes the dot product of the two givengraphene_point3d_t
.- Parameters:
b
- agraphene_point3d_t
- Returns:
- the value of the dot product
-
equal
Checks whether two given points are equal.- Parameters:
b
- agraphene_point3d_t
- Returns:
true
if the points are equal
-
free
public void free()Frees the resources allocated via graphene_point3d_alloc(). -
init
Initializes agraphene_point3d_t
with the given coordinates.- Parameters:
x
- the X coordinate of the pointy
- the Y coordinate of the pointz
- the Z coordinate of the point- Returns:
- the initialized
graphene_point3d_t
-
initFromPoint
-
initFromVec3
-
interpolate
Linearly interpolates each component of this Point3D andb
using the providedfactor
, and places the result inres
.- Parameters:
b
- agraphene_point3d_t
factor
- the interpolation factorres
- the return location for the interpolatedgraphene_point3d_t
-
length
public float length()Computes the length of the vector represented by the coordinates of the givengraphene_point3d_t
.- Returns:
- the length of the vector represented by the point
-
near
Checks whether the two points are near each other, within anepsilon
factor.- Parameters:
b
- agraphene_point3d_t
epsilon
- fuzzyness factor- Returns:
true
if the points are near each other
-
normalize
Computes the normalization of the vector represented by the coordinates of the givengraphene_point3d_t
.- Parameters:
res
- return location for the normalizedgraphene_point3d_t
-
normalizeViewport
Normalizes the coordinates of agraphene_point3d_t
using the given viewport and clipping planes.The coordinates of the resulting
graphene_point3d_t
will be in the [ -1, 1 ] range.- Parameters:
viewport
- agraphene_rect_t
representing a viewportzNear
- the coordinate of the near clipping plane, or 0 for the default near clipping planezFar
- the coordinate of the far clipping plane, or 1 for the default far clipping planeres
- the return location for the normalizedgraphene_point3d_t
-
scale
Scales the coordinates of the givengraphene_point3d_t
by the givenfactor
.- Parameters:
factor
- the scaling factorres
- return location for the scaled point
-
toVec3
Stores the coordinates of agraphene_point3d_t
into agraphene_vec3_t
.- Parameters:
v
- return location for agraphene_vec3_t
-