Package org.gnome.graphene
Class Ray
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.graphene.Ray
- All Implemented Interfaces:
Proxy
A ray emitted from an origin in a given direction.
The contents of the graphene_ray_t structure are private, and should not
be modified directly.
- Since:
- 1.4
-
Constructor Summary
ConstructorsConstructorDescriptionRay()Allocate a new Ray.Allocate a new Ray.Ray(MemorySegment address) Create a Ray proxy instance for the provided memory address.Allocate a new Ray with the fields set to the provided values.Allocate a new Ray with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic Rayalloc()Allocates a newgraphene_ray_tstructure.booleanChecks whether the two givengraphene_ray_tare equal.voidfree()Frees the resources allocated by graphene_ray_alloc().voidgetClosestPointToPoint(Point3D p, Point3D res) Computes the point on the givengraphene_ray_tthat is closest to the given pointp.voidgetDirection(Vec3 direction) Retrieves the direction of the givengraphene_ray_t.floatComputes the distance of the origin of the givengraphene_ray_tfrom the given plane.floatComputes the distance of the closest approach between the givengraphene_ray_tthis Ray and the pointp.static MemoryLayoutThe memory layout of the native struct.voidRetrieves the origin of the givengraphene_ray_t.voidgetPositionAt(float t, Point3D position) Retrieves the coordinates of a point at the distancetalong the givengraphene_ray_t.static @Nullable TypegetType()Get the GType of the Ray classInitializes the givengraphene_ray_tusing the givenoriginanddirectionvalues.initFromRay(Ray src) Initializes the givengraphene_ray_tusing the origin and direction values of anothergraphene_ray_t.initFromVec3(@Nullable Vec3 origin, @Nullable Vec3 direction) Initializes the givengraphene_ray_tusing the given vectors.intersectBox(Box b, Out<Float> tOut) Intersects the givengraphene_ray_tthis Ray with the givengraphene_box_tb.booleanintersectsBox(Box b) Checks whether the givengraphene_ray_tthis Ray intersects the givengraphene_box_tb.intersectSphere(Sphere s, Out<Float> tOut) Intersects the givengraphene_ray_tthis Ray with the givengraphene_sphere_ts.booleanChecks if the givengraphene_ray_tthis Ray intersects the givengraphene_sphere_ts.booleanChecks whether the givengraphene_ray_tthis Ray intersects the givengraphene_triangle_tb.intersectTriangle(Triangle t, Out<Float> tOut) Intersects the givengraphene_ray_tthis Ray with the givengraphene_triangle_tt.@Nullable Vec3Read the value of the fielddirection.@Nullable Vec3Read the value of the fieldorigin.voidwriteDirection(@Nullable Vec3 direction) Write a value in the fielddirection.voidwriteOrigin(@Nullable Vec3 origin) Write a value in the fieldorigin.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Ray
Create a Ray proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Ray
Allocate a new Ray.- Parameters:
arena- to control the memory allocation scope
-
Ray
public Ray()Allocate a new Ray. The memory is allocated withArena.ofAuto(). -
Ray
-
Ray
Allocate a new Ray with the fields set to the provided values. The memory is allocated withArena.ofAuto().- Parameters:
origin- value for the fieldorigindirection- value for the fielddirection
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readOrigin
Read the value of the fieldorigin.- Returns:
- The value of the field
origin
-
writeOrigin
Write a value in the fieldorigin.- Parameters:
origin- The new value for the fieldorigin
-
readDirection
Read the value of the fielddirection.- Returns:
- The value of the field
direction
-
writeDirection
Write a value in the fielddirection.- Parameters:
direction- The new value for the fielddirection
-
alloc
Allocates a newgraphene_ray_tstructure.The contents of the returned structure are undefined.
- Returns:
- the newly allocated
graphene_ray_t. Use graphene_ray_free() to free the resources allocated by this function - Since:
- 1.4
-
equal
Checks whether the two givengraphene_ray_tare equal.- Parameters:
b- agraphene_ray_t- Returns:
trueif the given rays are equal- Since:
- 1.4
-
free
public void free()Frees the resources allocated by graphene_ray_alloc().- Since:
- 1.4
-
getClosestPointToPoint
-
getDirection
Retrieves the direction of the givengraphene_ray_t.- Parameters:
direction- return location for the direction- Since:
- 1.4
-
getDistanceToPlane
Computes the distance of the origin of the givengraphene_ray_tfrom the given plane.If the ray does not intersect the plane, this function returns
INFINITY.- Parameters:
p- agraphene_plane_t- Returns:
- the distance of the origin of the ray from the plane
- Since:
- 1.4
-
getDistanceToPoint
Computes the distance of the closest approach between the givengraphene_ray_tthis Ray and the pointp.The closest approach to a ray from a point is the distance between the point and the projection of the point on the ray itself.
- Parameters:
p- agraphene_point3d_t- Returns:
- the distance of the point
- Since:
- 1.4
-
getOrigin
Retrieves the origin of the givengraphene_ray_t.- Parameters:
origin- return location for the origin- Since:
- 1.4
-
getPositionAt
Retrieves the coordinates of a point at the distancetalong the givengraphene_ray_t.- Parameters:
t- the distance along the rayposition- return location for the position- Since:
- 1.4
-
init
-
initFromRay
-
initFromVec3
-
intersectBox
Intersects the givengraphene_ray_tthis Ray with the givengraphene_box_tb.- Parameters:
b- agraphene_box_ttOut- the distance of the point on the ray that intersects the box- Returns:
- the type of intersection
- Since:
- 1.10
-
intersectSphere
Intersects the givengraphene_ray_tthis Ray with the givengraphene_sphere_ts.- Parameters:
s- agraphene_sphere_ttOut- the distance of the point on the ray that intersects the sphere- Returns:
- the type of intersection
- Since:
- 1.10
-
intersectTriangle
Intersects the givengraphene_ray_tthis Ray with the givengraphene_triangle_tt.- Parameters:
t- agraphene_triangle_ttOut- the distance of the point on the ray that intersects the triangle- Returns:
- the type of intersection
- Since:
- 1.10
-
intersectsBox
Checks whether the givengraphene_ray_tthis Ray intersects the givengraphene_box_tb.See also: graphene_ray_intersect_box()
- Parameters:
b- agraphene_box_t- Returns:
trueif the ray intersects the box- Since:
- 1.10
-
intersectsSphere
Checks if the givengraphene_ray_tthis Ray intersects the givengraphene_sphere_ts.See also: graphene_ray_intersect_sphere()
- Parameters:
s- agraphene_sphere_t- Returns:
trueif the ray intersects the sphere- Since:
- 1.10
-
intersectsTriangle
Checks whether the givengraphene_ray_tthis Ray intersects the givengraphene_triangle_tb.See also: graphene_ray_intersect_triangle()
- Parameters:
t- agraphene_triangle_t- Returns:
trueif the ray intersects the triangle- Since:
- 1.10
-