// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.

///|
#external
pub type Ray

///|
#module("@mizchi/three-mbt/constructors")
pub extern "js" fn Ray::Ray(origin : Vector3, direction : Vector3) -> Ray = "ray"

///|
pub extern "js" fn Ray::origin(self : Ray) -> Vector3 =
  #| (self) => self.origin

///|
pub extern "js" fn Ray::direction(self : Ray) -> Vector3 =
  #| (self) => self.direction

///|
pub extern "js" fn Ray::set(
  self : Ray,
  origin : Vector3,
  direction : Vector3,
) -> Ray =
  #| (self, origin, direction) => self.set(origin, direction)

///|
pub extern "js" fn Ray::at(
  self : Ray,
  distance : Double,
  target : Vector3,
) -> Vector3 =
  #| (self, distance, target) => self.at(distance, target)

///|
extern "js" fn Ray::ffi_intersect_plane(
  self : Ray,
  plane : Plane,
  target : Vector3,
) -> Nullable[Vector3] =
  #| (self, plane, target) => self.intersectPlane(plane, target)

///|
pub fn Ray::intersect_plane(
  self : Ray,
  plane : Plane,
  target : Vector3,
) -> Vector3? {
  self.ffi_intersect_plane(plane, target).to_option()
}

///|
extern "js" fn Ray::ffi_intersect_box(
  self : Ray,
  box : Box3,
  target : Vector3,
) -> Nullable[Vector3] =
  #| (self, box, target) => self.intersectBox(box, target)

///|
pub fn Ray::intersect_box(self : Ray, box : Box3, target : Vector3) -> Vector3? {
  self.ffi_intersect_box(box, target).to_option()
}

///|
extern "js" fn Ray::ffi_intersect_sphere(
  self : Ray,
  sphere : Sphere,
  target : Vector3,
) -> Nullable[Vector3] =
  #| (self, sphere, target) => self.intersectSphere(sphere, target)

///|
pub fn Ray::intersect_sphere(
  self : Ray,
  sphere : Sphere,
  target : Vector3,
) -> Vector3? {
  self.ffi_intersect_sphere(sphere, target).to_option()
}

///|
pub extern "js" fn Ray::distance_to_point(
  self : Ray,
  point : Vector3,
) -> Double =
  #| (self, point) => self.distanceToPoint(point)

///|
pub extern "js" fn Ray::apply_matrix4(self : Ray, matrix : Matrix4) -> Ray =
  #| (self, matrix) => self.applyMatrix4(matrix)

///|
pub extern "js" fn Ray::clone(self : Ray) -> Ray =
  #| (self) => self.clone()

///|
pub extern "js" fn Ray::copy(self : Ray, other : Ray) -> Ray =
  #| (self, other) => self.copy(other)

///|
pub extern "js" fn Ray::equals(self : Ray, other : Ray) -> Bool =
  #| (self, other) => self.equals(other)

///|
pub extern "js" fn Ray::look_at(self : Ray, target : Vector3) -> Ray =
  #| (self, target) => self.lookAt(target)

///|
pub extern "js" fn Ray::recast(self : Ray, distance : Double) -> Ray =
  #| (self, distance) => self.recast(distance)

///|
pub extern "js" fn Ray::closest_point_to_point(
  self : Ray,
  point : Vector3,
  target : Vector3,
) -> Vector3 =
  #| (self, point, target) => self.closestPointToPoint(point, target)

///|
pub extern "js" fn Ray::distance_squared_to_point(
  self : Ray,
  point : Vector3,
) -> Double =
  #| (self, point) => self.distanceSqToPoint(point)

///|
pub extern "js" fn Ray::distance_squared_to_segment(
  self : Ray,
  start : Vector3,
  end : Vector3,
  target_on_ray : Vector3,
  target_on_segment : Vector3,
) -> Double =
  #| (self, start, end, target_on_ray, target_on_segment) => self.distanceSqToSegment(start, end, target_on_ray, target_on_segment)

///|
pub extern "js" fn Ray::intersects_sphere(self : Ray, other : Sphere) -> Bool =
  #| (self, other) => self.intersectsSphere(other)

///|
pub extern "js" fn Ray::intersects_plane(self : Ray, other : Plane) -> Bool =
  #| (self, other) => self.intersectsPlane(other)

///|
pub extern "js" fn Ray::intersects_box(self : Ray, other : Box3) -> Bool =
  #| (self, other) => self.intersectsBox(other)

///|
extern "js" fn Ray::ffi_distance_to_plane(
  self : Ray,
  plane : Plane,
) -> Nullable[Double] =
  #| (self, plane) => self.distanceToPlane(plane)

///|
pub fn Ray::distance_to_plane(self : Ray, plane : Plane) -> Double? {
  self.ffi_distance_to_plane(plane).to_option()
}

///|
extern "js" fn Ray::ffi_intersect_triangle(
  self : Ray,
  a : Vector3,
  b : Vector3,
  c : Vector3,
  backface_culling : Bool,
  target : Vector3,
) -> Nullable[Vector3] =
  #| (self, a, b, c, backface_culling, target) => self.intersectTriangle(a, b, c, backface_culling, target)

///|
pub fn Ray::intersect_triangle(
  self : Ray,
  a : Vector3,
  b : Vector3,
  c : Vector3,
  backface_culling : Bool,
  target : Vector3,
) -> Vector3? {
  self.ffi_intersect_triangle(a, b, c, backface_culling, target).to_option()
}