Package org.gnome.graphene
Class Point3D
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.graphene.Point3D
-
Constructor Summary
ConstructorsConstructorDescriptionPoint3D()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 Point3Dalloc()Allocates agraphene_point3d_tstructure.voidComputes the cross product of the two givengraphene_point3d_t.floatComputes the distance between the two givengraphene_point3d_t.floatComputes the dot product of the two givengraphene_point3d_t.booleanChecks whether two given points are equal.voidfree()Frees the resources allocated via graphene_point3d_alloc().static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Point3D classinit(float x, float y, float z) Initializes agraphene_point3d_twith the given coordinates.initFromPoint(Point3D src) Initializes agraphene_point3d_tusing the coordinates of anothergraphene_point3d_t.initFromVec3(Vec3 v) Initializes agraphene_point3d_tusing the components of agraphene_vec3_t.voidinterpolate(Point3D b, double factor, Point3D res) Linearly interpolates each component of this Point3D andbusing the providedfactor,and places the result inres.floatlength()Computes the length of the vector represented by the coordinates of the givengraphene_point3d_t.booleanChecks whether the two points are near each other, within anepsilonfactor.voidComputes the normalization of the vector represented by the coordinates of the givengraphene_point3d_t.voidnormalizeViewport(Rect viewport, float zNear, float zFar, Point3D res) Normalizes the coordinates of agraphene_point3d_tusing the given viewport and clipping planes.floatreadX()Read the value of the fieldx.floatreadY()Read the value of the fieldy.floatreadZ()Read the value of the fieldz.voidScales the coordinates of the givengraphene_point3d_tby the givenfactor.voidStores the coordinates of agraphene_point3d_tinto agraphene_vec3_t.voidwriteX(float x) Write a value in the fieldx.voidwriteY(float y) Write a value in the fieldy.voidwriteZ(float z) Write a value in the fieldz.static Point3Dzero()Retrieves a constant point with all three coordinates set to 0.Methods inherited from class org.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 fieldxy- value for the fieldyz- value for the fieldzarena- 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 fieldxy- value for the fieldyz- 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_tstructure.- Returns:
- the newly allocated structure. Use graphene_point3d_free() to free the resources allocated by this function.
- Since:
- 1.0
-
zero
Retrieves a constant point with all three coordinates set to 0.- Returns:
- a zero point
- Since:
- 1.0
-
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
- Since:
- 1.0
-
equal
Checks whether two given points are equal.- Parameters:
b- agraphene_point3d_t- Returns:
trueif the points are equal- Since:
- 1.0
-
free
public void free()Frees the resources allocated via graphene_point3d_alloc().- Since:
- 1.0
-
init
Initializes agraphene_point3d_twith 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 - Since:
- 1.0
-
initFromPoint
-
initFromVec3
-
interpolate
Linearly interpolates each component of this Point3D andbusing the providedfactor,and places the result inres.- Parameters:
b- agraphene_point3d_tfactor- the interpolation factorres- the return location for the interpolatedgraphene_point3d_t- Since:
- 1.0
-
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
- Since:
- 1.0
-
near
Checks whether the two points are near each other, within anepsilonfactor.- Parameters:
b- agraphene_point3d_tepsilon- fuzzyness factor- Returns:
trueif the points are near each other- Since:
- 1.0
-
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- Since:
- 1.0
-
normalizeViewport
Normalizes the coordinates of agraphene_point3d_tusing the given viewport and clipping planes.The coordinates of the resulting
graphene_point3d_twill be in the [ -1, 1 ] range.- Parameters:
viewport- agraphene_rect_trepresenting 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- Since:
- 1.4
-
scale
Scales the coordinates of the givengraphene_point3d_tby the givenfactor.- Parameters:
factor- the scaling factorres- return location for the scaled point- Since:
- 1.0
-
toVec3
Stores the coordinates of agraphene_point3d_tinto agraphene_vec3_t.- Parameters:
v- return location for agraphene_vec3_t- Since:
- 1.0
-