module Diorite::GeometryBuilder

Overview

High-performance algorithmic generator for 2D and 3D debug geometry.

Emits line-list vertices (Vector3 or Vector2) and vertex color arrays suitable for direct ingestion by Godot's ImmediateMesh surface buffers (surface_add_vertex and surface_set_color).

Designed for zero heap reallocation during frame loops when passed pre-sized arrays.

Included Modules

Defined in:

diorite/core/geometry_builder.cr

Class Method Summary

Class methods inherited from module Diorite::MathHelpers

deg_to_rad(degrees : Number) : Float32 deg_to_rad, find_perpendicular(normal : Godot::Vector3) : Godot::Vector3 find_perpendicular, orthonormal_plane(normal : Godot::Vector3) : Tuple(Godot::Vector3, Godot::Vector3) orthonormal_plane, rad_to_deg(radians : Number) : Float32 rad_to_deg, rotate_around_axis(point : Godot::Vector3, axis : Godot::Vector3, theta : Float32) : Godot::Vector3 rotate_around_axis

Class Method Detail

def self.build_actor_card_3d(position : Godot::Vector3, size : Godot::Vector2, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D actor card frame with ground anchor line.


[View source]
def self.build_arc_2d(center : Godot::Vector2, radius : Float32, start_angle : Float32, end_angle : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a 2D circular arc segment.


[View source]
def self.build_arrow(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color, head_size : Float32, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D directional arrow with a 4-fin conical arrowhead.


[View source]
def self.build_arrow_2d(from : Godot::Vector2, to : Godot::Vector2, head_size : Float32, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a 2D directional arrow with a triangular head on the canvas overlay.


[View source]
def self.build_bezier_cubic(p0 : Godot::Vector3, p1 : Godot::Vector3, p2 : Godot::Vector3, p3 : Godot::Vector3, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color), show_hull : Bool = true) : Void #

Generates a 3D cubic Bézier spline curve.


[View source]
def self.build_billboard_square(position : Godot::Vector3, size : Float32, camera_pos : Godot::Vector3, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a camera-facing billboard square marker in 3D world space.


[View source]
def self.build_box(center : Godot::Vector3, size : Godot::Vector3, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates an axis-aligned 3D bounding box (AABB) wireframe with 12 edges.


[View source]
def self.build_box_cast(from : Godot::Vector3, to : Godot::Vector3, size : Godot::Vector3, hit : Bool, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D swept oriented or axis-aligned box cast between from and to.


[View source]
def self.build_camera_frustum(origin : Godot::Vector3, basis : Godot::Basis, fov_deg : Float32, near : Float32, far : Float32, aspect : Float32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D camera view frustum pyramid with near and far clipping rectangles.


[View source]
def self.build_capsule(center : Godot::Vector3, radius : Float32, height : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D wireframe capsule with hemispherical domes and side struts.


[View source]
def self.build_capsule_2d(p0 : Godot::Vector2, p1 : Godot::Vector2, radius : Float32, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color), segments : Int32 = 12) : Void #

Generates a 2D wireframe stadium capsule connecting two center points with semicircular caps.


[View source]
def self.build_capsule_cast(from : Godot::Vector3, to : Godot::Vector3, radius : Float32, height : Float32, hit : Bool, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D swept capsule cast between from and to.


[View source]
def self.build_catmull_rom(points : Array(Godot::Vector3), segments_per_curve : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color), loop : Bool = false) : Void #

Generates a 3D Catmull-Rom spline through a sequence of waypoints.


[View source]
def self.build_circle_2d(center : Godot::Vector2, radius : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a 2D wireframe circle on the canvas overlay.


[View source]
def self.build_circle_3d(center : Godot::Vector3, normal : Godot::Vector3, radius : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates an arbitrary 3D planar circle ring.


[View source]
def self.build_cone_3d(tip : Godot::Vector3, dir : Godot::Vector3, length : Float32, angle_rad : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D vision cone or spotlight frustum.


[View source]
def self.build_cylinder(center : Godot::Vector3, radius : Float32, height : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D wireframe cylinder with circular caps and longitudinal ribs.


[View source]
def self.build_gizmo(origin : Godot::Vector3, basis : Godot::Basis, size : Float32, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D coordinate transform gizmo with Red=X, Green=Y, Blue=Z axis vectors.


[View source]
def self.build_grid(center : Godot::Vector3, size : Godot::Vector2, subdivisions : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D ground reference grid plane.


[View source]
def self.build_line(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a single 3D line segment between from and to.


[View source]
def self.build_line_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a 2D line segment between two canvas pixel coordinates.


[View source]
def self.build_line_path(points : Array(Godot::Vector3), color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a continuous 3D polyline connecting an ordered list of points.


[View source]
def self.build_obb(center : Godot::Vector3, size : Godot::Vector3, basis : Godot::Basis, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates an arbitrarily oriented bounding box (OBB) defined by a 3x3 rotation Basis.


[View source]
def self.build_path_2d(points : Array(Godot::Vector2), color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a continuous 2D polyline connecting an ordered list of canvas points.


[View source]
def self.build_plane(center : Godot::Vector3, normal : Godot::Vector3, size : Godot::Vector2, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates an oriented 3D plane quad with a center normal pointer.


[View source]
def self.build_points(points : Array(Godot::Vector3), size : Float32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates small 3D crosshair markers for an array of world points.


[View source]
def self.build_points_2d(points : Array(Godot::Vector2), size : Float32, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates crosshair markers for a collection of 2D points on the canvas.


[View source]
def self.build_position_3d(origin : Godot::Vector3, size : Float32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3-axis crossing crosshair indicating position and scale.


[View source]
def self.build_ray_hit(origin : Godot::Vector3, hit_point : Godot::Vector3, normal : Godot::Vector3, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a raycast hit visualization: incident ray, surface impact disc, and surface normal reflection vector.


[View source]
def self.build_rect_2d(rect : Godot::Rect2, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a 2D wireframe rectangle on the canvas overlay.


[View source]
def self.build_reticle(position : Godot::Vector3, normal : Godot::Vector3, size : Float32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates an aim reticle with a center circle and 4 corner target brackets.


[View source]
def self.build_ruler(from : Godot::Vector3, to : Godot::Vector3, tick_size : Float32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a calibrated distance measurement ruler bar with tick marks between two points.


[View source]
def self.build_ruler_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color), tick_step : Float32 = 20.0_f32, tick_size : Float32 = 8.0_f32) : Void #

Generates a 2D calibrated measuring ruler with distance tick marks.


[View source]
def self.build_sector_2d(center : Godot::Vector2, radius : Float32, start_angle : Float32, end_angle : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a 2D pie-slice sector with bounding radial rays.


[View source]
def self.build_sphere(center : Godot::Vector3, radius : Float32, rings : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D wireframe sphere composed of 3 orthogonal intersecting rings.


[View source]
def self.build_sphere_cast(from : Godot::Vector3, to : Godot::Vector3, radius : Float32, hit : Bool, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D swept sphere cast visualizing collision trajectory between from and to.


[View source]
def self.build_spring(from : Godot::Vector3, to : Godot::Vector3, radius : Float32, coils : Int32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a 3D helical wire spring between two world endpoints.


[View source]
def self.build_surface_disk(position : Godot::Vector3, normal : Godot::Vector3, radius : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a normal-aligned circular surface disc indicating a collision or ground contact patch.


[View source]
def self.build_trajectory_arc(origin : Godot::Vector3, velocity : Godot::Vector3, gravity : Godot::Vector3, max_time : Float32, steps : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a ballistic parabolic trajectory arc computed under gravity.


[View source]
def self.build_vision_cone(origin : Godot::Vector3, direction : Godot::Vector3, angle_deg : Float32, range : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector3), cols : Array(Godot::Color)) : Void #

Generates a spherical sector vision/detection cone for AI sensory perception.


[View source]
def self.build_vision_cone_2d(origin : Godot::Vector2, dir : Godot::Vector2, distance : Float32, angle_rad : Float32, segments : Int32, color : Godot::Color, verts : Array(Godot::Vector2), cols : Array(Godot::Color)) : Void #

Generates a 2D vision cone or field-of-view wedge.


[View source]