HAIDOX
HAIDOX Help

Math Engine Reference: Geometry

개요

3차원 기본 도형의 최근접점, 교차와 연속 충돌 계산 C API를 선언한다.

Caller-owned ray, sphere와 plane 값에 대해 allocation 없는 결정적 계산을 제공한다. 모든 좌표와 길이는 caller가 선택한 하나의 일관된 단위와 동일한 Cartesian frame을 쓴다.

공개 API

Header 사용 시작

이 module의 public declaration을 사용하려면 installed SDK의 다음 header를 include한다.

#include <math_engine/math_engine_geometry.h>

Type과 callback

math_engine_ray3_f64_t

3차원 ray의 원점과 0이 아닌 방향 vector를 보관하는 caller-owned POD다.

typedef struct math_engine_ray3_f64 {
    math_engine_vec3_f64_t origin; /**< Finite ray origin in the query's Cartesian frame. */
    math_engine_vec3_f64_t direction; /**< Finite nonzero direction; normalization is not required. */
} math_engine_ray3_f64_t;
  • math_engine_ray3_f64_t.origin

    Finite ray origin in the query's Cartesian frame.

    math_engine_vec3_f64_t origin;
    
  • math_engine_ray3_f64_t.direction

    Finite nonzero direction; normalization is not required.

    math_engine_vec3_f64_t direction;
    

math_engine_sphere3_f64_t

3차원 sphere의 중심과 0 이상인 반지름을 보관하는 caller-owned POD다.

typedef struct math_engine_sphere3_f64 {
    math_engine_vec3_f64_t center; /**< Finite center in the query's Cartesian frame. */
    double radius; /**< Finite nonnegative radius in the frame's length unit. */
} math_engine_sphere3_f64_t;
  • math_engine_sphere3_f64_t.center

    Finite center in the query's Cartesian frame.

    math_engine_vec3_f64_t center;
    
  • math_engine_sphere3_f64_t.radius

    Finite nonnegative radius in the frame's length unit.

    double radius;
    

math_engine_plane3_f64_t

=dot(normal, point) + offset = 0=인 plane을 보관하는 caller-owned POD다.

typedef struct math_engine_plane3_f64 {
    math_engine_vec3_f64_t normal; /**< Finite nonzero plane normal; normalization is not required. */
    double offset; /**< Finite constant in =dot(normal,point)+offset=0=. */
} math_engine_plane3_f64_t;
  • math_engine_plane3_f64_t.normal

    Finite nonzero plane normal; normalization is not required.

    math_engine_vec3_f64_t normal;
    
  • math_engine_plane3_f64_t.offset

    Finite constant in dot(normal,point)+offset=0.

    double offset;
    

math_engine_line3_f64_t

Infinite 3D line. The direction must be non-zero for a query.

typedef struct math_engine_line3_f64 {
    math_engine_vec3_f64_t origin; /**< Finite point on the infinite line. */
    math_engine_vec3_f64_t direction; /**< Finite nonzero line direction; not necessarily unit length. */
} math_engine_line3_f64_t;
  • math_engine_line3_f64_t.origin

    Finite point on the infinite line.

    math_engine_vec3_f64_t origin;
    
  • math_engine_line3_f64_t.direction

    Finite nonzero line direction; not necessarily unit length.

    math_engine_vec3_f64_t direction;
    

math_engine_segment3_f64_t

Closed 3D line segment.

typedef struct math_engine_segment3_f64 {
    math_engine_vec3_f64_t start; /**< Finite endpoint at closed-segment parameter 0. */
    math_engine_vec3_f64_t end; /**< Finite endpoint at closed-segment parameter 1. */
} math_engine_segment3_f64_t;
  • math_engine_segment3_f64_t.start

    Finite endpoint at closed-segment parameter 0.

    math_engine_vec3_f64_t start;
    
  • math_engine_segment3_f64_t.end

    Finite endpoint at closed-segment parameter 1.

    math_engine_vec3_f64_t end;
    

math_engine_aabb3_f64_t

Axis-aligned box with component-wise minimum < maximum=.

typedef struct math_engine_aabb3_f64 {
    math_engine_vec3_f64_t minimum; /**< Finite component-wise inclusive lower corner. */
    math_engine_vec3_f64_t maximum; /**< Finite inclusive upper corner, component-wise not below minimum. */
} math_engine_aabb3_f64_t;
  • math_engine_aabb3_f64_t.minimum

    Finite component-wise inclusive lower corner.

    math_engine_vec3_f64_t minimum;
    
  • math_engine_aabb3_f64_t.maximum

    Finite inclusive upper corner, component-wise not below minimum.

    math_engine_vec3_f64_t maximum;
    

math_engine_triangle3_f64_t

Ordered 3D triangle. Reversing two vertices reverses its winding.

typedef struct math_engine_triangle3_f64 {
    math_engine_vec3_f64_t a; /**< First finite vertex and barycentric component 0. */
    math_engine_vec3_f64_t b; /**< Second finite vertex and barycentric component 1. */
    math_engine_vec3_f64_t c; /**< Third finite vertex and barycentric component 2. */
} math_engine_triangle3_f64_t;
  • math_engine_triangle3_f64_t.a

    First finite vertex and barycentric component 0.

    math_engine_vec3_f64_t a;
    
  • math_engine_triangle3_f64_t.b

    Second finite vertex and barycentric component 1.

    math_engine_vec3_f64_t b;
    
  • math_engine_triangle3_f64_t.c

    Third finite vertex and barycentric component 2.

    math_engine_vec3_f64_t c;
    

math_engine_geometry_relation_t

Topological relation. INVALID is never a successful query result.

typedef enum math_engine_geometry_relation {
    MATH_ENGINE_GEOMETRY_RELATION_INVALID = 0, /**< No successful relation was classified. */
    MATH_ENGINE_GEOMETRY_RELATION_DISJOINT = 1, /**< Shapes are separated beyond context tolerance. */
    MATH_ENGINE_GEOMETRY_RELATION_TOUCHING = 2, /**< Boundaries meet within context tolerance. */
    MATH_ENGINE_GEOMETRY_RELATION_INTERSECTING = 3, /**< Query primitives have a proper intersection. */
    MATH_ENGINE_GEOMETRY_RELATION_OVERLAPPING = 4, /**< Volumes or intervals overlap without containment. */
    MATH_ENGINE_GEOMETRY_RELATION_COPLANAR = 5, /**< Primitive lies in the same plane within tolerance. */
    MATH_ENGINE_GEOMETRY_RELATION_CONTAINED = 6 /**< One queried shape is contained by the other. */
} math_engine_geometry_relation_t;
  • math_engine_geometry_relation_t.MATH_ENGINE_GEOMETRY_RELATION_INVALID

    No successful relation was classified.

    MATH_ENGINE_GEOMETRY_RELATION_INVALID = 0,
    
  • math_engine_geometry_relation_t.MATH_ENGINE_GEOMETRY_RELATION_DISJOINT

    Shapes are separated beyond context tolerance.

    MATH_ENGINE_GEOMETRY_RELATION_DISJOINT = 1,
    
  • math_engine_geometry_relation_t.MATH_ENGINE_GEOMETRY_RELATION_TOUCHING

    Boundaries meet within context tolerance.

    MATH_ENGINE_GEOMETRY_RELATION_TOUCHING = 2,
    
  • math_engine_geometry_relation_t.MATH_ENGINE_GEOMETRY_RELATION_INTERSECTING

    Query primitives have a proper intersection.

    MATH_ENGINE_GEOMETRY_RELATION_INTERSECTING = 3,
    
  • math_engine_geometry_relation_t.MATH_ENGINE_GEOMETRY_RELATION_OVERLAPPING

    Volumes or intervals overlap without containment.

    MATH_ENGINE_GEOMETRY_RELATION_OVERLAPPING = 4,
    
  • math_engine_geometry_relation_t.MATH_ENGINE_GEOMETRY_RELATION_COPLANAR

    Primitive lies in the same plane within tolerance.

    MATH_ENGINE_GEOMETRY_RELATION_COPLANAR = 5,
    
  • math_engine_geometry_relation_t.MATH_ENGINE_GEOMETRY_RELATION_CONTAINED

    One queried shape is contained by the other.

    MATH_ENGINE_GEOMETRY_RELATION_CONTAINED = 6,
    

math_engine_geometry_feature_kind_t

Feature class used with the zero-based feature_*_id fields.

typedef enum math_engine_geometry_feature_kind {
    MATH_ENGINE_GEOMETRY_FEATURE_NONE = 0, /**< No discrete feature applies; ID is -1. */
    MATH_ENGINE_GEOMETRY_FEATURE_VERTEX = 1, /**< Zero-based vertex feature. */
    MATH_ENGINE_GEOMETRY_FEATURE_EDGE = 2, /**< Zero-based edge feature. */
    MATH_ENGINE_GEOMETRY_FEATURE_FACE = 3, /**< Zero-based face feature. */
    MATH_ENGINE_GEOMETRY_FEATURE_INTERIOR = 4 /**< Shape or primitive interior feature. */
} math_engine_geometry_feature_kind_t;
  • math_engine_geometry_feature_kind_t.MATH_ENGINE_GEOMETRY_FEATURE_NONE

    No discrete feature applies; ID is -1.

    MATH_ENGINE_GEOMETRY_FEATURE_NONE = 0,
    
  • math_engine_geometry_feature_kind_t.MATH_ENGINE_GEOMETRY_FEATURE_VERTEX

    Zero-based vertex feature.

    MATH_ENGINE_GEOMETRY_FEATURE_VERTEX = 1,
    
  • math_engine_geometry_feature_kind_t.MATH_ENGINE_GEOMETRY_FEATURE_EDGE

    Zero-based edge feature.

    MATH_ENGINE_GEOMETRY_FEATURE_EDGE = 2,
    
  • math_engine_geometry_feature_kind_t.MATH_ENGINE_GEOMETRY_FEATURE_FACE

    Zero-based face feature.

    MATH_ENGINE_GEOMETRY_FEATURE_FACE = 3,
    
  • math_engine_geometry_feature_kind_t.MATH_ENGINE_GEOMETRY_FEATURE_INTERIOR

    Shape or primitive interior feature.

    MATH_ENGINE_GEOMETRY_FEATURE_INTERIOR = 4,
    

math_engine_geometry_orientation_t

Predicate sign, including a tolerance-classified zero.

typedef enum math_engine_geometry_orientation {
    MATH_ENGINE_GEOMETRY_ORIENTATION_NEGATIVE = -1, /**< Predicate value is below its negative tolerance. */
    MATH_ENGINE_GEOMETRY_ORIENTATION_ZERO = 0, /**< Predicate is tolerance-classified as zero. */
    MATH_ENGINE_GEOMETRY_ORIENTATION_POSITIVE = 1 /**< Predicate value is above its positive tolerance. */
} math_engine_geometry_orientation_t;
  • math_engine_geometry_orientation_t.MATH_ENGINE_GEOMETRY_ORIENTATION_NEGATIVE

    Predicate value is below its negative tolerance.

    MATH_ENGINE_GEOMETRY_ORIENTATION_NEGATIVE = -1,
    
  • math_engine_geometry_orientation_t.MATH_ENGINE_GEOMETRY_ORIENTATION_ZERO

    Predicate is tolerance-classified as zero.

    MATH_ENGINE_GEOMETRY_ORIENTATION_ZERO = 0,
    
  • math_engine_geometry_orientation_t.MATH_ENGINE_GEOMETRY_ORIENTATION_POSITIVE

    Predicate value is above its positive tolerance.

    MATH_ENGINE_GEOMETRY_ORIENTATION_POSITIVE = 1,
    

math_engine_geometry_certainty_t

Whether the predicate result crossed a refinement boundary.

typedef enum math_engine_geometry_certainty {
    MATH_ENGINE_GEOMETRY_CERTAINTY_INVALID = 0, /**< No successful predicate result. */
    MATH_ENGINE_GEOMETRY_CERTAINTY_CERTAIN = 1, /**< Initial evaluation is outside its error boundary. */
    MATH_ENGINE_GEOMETRY_CERTAINTY_UNCERTAIN = 2, /**< GAME_FAST result remains inside the error boundary. */
    MATH_ENGINE_GEOMETRY_CERTAINTY_REFINED = 3 /**< Robust backend refined a near-boundary result. */
} math_engine_geometry_certainty_t;
  • math_engine_geometry_certainty_t.MATH_ENGINE_GEOMETRY_CERTAINTY_INVALID

    No successful predicate result.

    MATH_ENGINE_GEOMETRY_CERTAINTY_INVALID = 0,
    
  • math_engine_geometry_certainty_t.MATH_ENGINE_GEOMETRY_CERTAINTY_CERTAIN

    Initial evaluation is outside its error boundary.

    MATH_ENGINE_GEOMETRY_CERTAINTY_CERTAIN = 1,
    
  • math_engine_geometry_certainty_t.MATH_ENGINE_GEOMETRY_CERTAINTY_UNCERTAIN

    GAME_FAST result remains inside the error boundary.

    MATH_ENGINE_GEOMETRY_CERTAINTY_UNCERTAIN = 2,
    
  • math_engine_geometry_certainty_t.MATH_ENGINE_GEOMETRY_CERTAINTY_REFINED

    Robust backend refined a near-boundary result.

    MATH_ENGINE_GEOMETRY_CERTAINTY_REFINED = 3,
    

math_engine_geometry_predicate_backend_t

Backend selected from the context mode.

typedef enum math_engine_geometry_predicate_backend {
    MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_INVALID = 0, /**< No backend selected. */
    MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_GAME_FAST = 1, /**< Bounded binary64 GAME_FAST predicate path. */
    MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_ROBUST = 2 /**< Refined desktop/FULL predicate path. */
} math_engine_geometry_predicate_backend_t;
  • math_engine_geometry_predicate_backend_t.MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_INVALID

    No backend selected.

    MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_INVALID = 0,
    
  • math_engine_geometry_predicate_backend_t.MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_GAME_FAST

    Bounded binary64 GAME_FAST predicate path.

    MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_GAME_FAST = 1,
    
  • math_engine_geometry_predicate_backend_t.MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_ROBUST

    Refined desktop/FULL predicate path.

    MATH_ENGINE_GEOMETRY_PREDICATE_BACKEND_ROBUST = 2,
    

math_engine_geometry_query_result_t

Versioned, caller-owned result shared by static geometry queries.

A successful miss uses MATH_ENGINE_RESULT_FLAG_MISS and DISJOINT. Invalid, non-finite and degenerate inputs instead return a negative status and preserve the complete output. Triangle barycentric order is always (a,b,c).

typedef struct math_engine_geometry_query_result {
    uint32_t struct_size; /**< Caller-provided byte size; at least =sizeof= this version. */
    uint32_t struct_version; /**< =MATH_ENGINE_GEOMETRY_QUERY_RESULT_VERSION_1=. */
    uint32_t flags; /**< Generic value/miss/uncertain result flags for this query. */
    int32_t relation; /**< One =math_engine_geometry_relation_t=. */
    int32_t orientation; /**< One =math_engine_geometry_orientation_t=. */
    int32_t certainty; /**< One =math_engine_geometry_certainty_t=. */
    int32_t predicate_backend; /**< Backend that produced or classified the predicate. */
    int32_t feature_a_kind; /**< Kind of witness feature on the first input shape. */
    int32_t feature_b_kind; /**< Kind of witness feature on the second input shape. */
    int32_t feature_a_id; /**< Zero-based first-shape feature ID, or -1 for NONE. */
    int32_t feature_b_id; /**< Zero-based second-shape feature ID, or -1 for NONE. */
    math_engine_vec3_f64_t point_a; /**< First finite witness/query point in the common frame. */
    math_engine_vec3_f64_t point_b; /**< Second finite closest/intersection point in the common frame. */
    math_engine_vec3_f64_t normal; /**< Finite query normal; unit length when the query defines one. */
    double parameter_a; /**< Query-specific finite parameter for the first primitive. */
    double parameter_b; /**< Query-specific finite parameter for the second primitive. */
    double barycentric[3]; /**< Triangle weights in =(a,b,c)= order; otherwise zero. */
    double signed_distance; /**< Signed gap/plane distance in the caller's length unit. */
    double distance_squared; /**< Nonnegative squared witness distance in length units squared. */
    double predicate_value; /**< Raw finite predicate value, such as =orient3d=. */
    double predicate_error_bound; /**< Nonnegative absolute bound in predicate-value units. */
    uint64_t reserved[2]; /**< Reserved words; written as 0. */
} math_engine_geometry_query_result_t;
  • math_engine_geometry_query_result_t.struct_size

    Caller-provided byte size; at least sizeof this version.

    uint32_t struct_size;
    
  • math_engine_geometry_query_result_t.struct_version

    MATH_ENGINE_GEOMETRY_QUERY_RESULT_VERSION_1.

    uint32_t struct_version;
    
  • math_engine_geometry_query_result_t.flags

    Generic value/miss/uncertain result flags for this query.

    uint32_t flags;
    
  • math_engine_geometry_query_result_t.relation

    One math_engine_geometry_relation_t.

    int32_t relation;
    
  • math_engine_geometry_query_result_t.orientation

    One math_engine_geometry_orientation_t.

    int32_t orientation;
    
  • math_engine_geometry_query_result_t.certainty

    One math_engine_geometry_certainty_t.

    int32_t certainty;
    
  • math_engine_geometry_query_result_t.predicate_backend

    Backend that produced or classified the predicate.

    int32_t predicate_backend;
    
  • math_engine_geometry_query_result_t.feature_a_kind

    Kind of witness feature on the first input shape.

    int32_t feature_a_kind;
    
  • math_engine_geometry_query_result_t.feature_b_kind

    Kind of witness feature on the second input shape.

    int32_t feature_b_kind;
    
  • math_engine_geometry_query_result_t.feature_a_id

    Zero-based first-shape feature ID, or -1 for NONE.

    int32_t feature_a_id;
    
  • math_engine_geometry_query_result_t.feature_b_id

    Zero-based second-shape feature ID, or -1 for NONE.

    int32_t feature_b_id;
    
  • math_engine_geometry_query_result_t.point_a

    First finite witness/query point in the common frame.

    math_engine_vec3_f64_t point_a;
    
  • math_engine_geometry_query_result_t.point_b

    Second finite closest/intersection point in the common frame.

    math_engine_vec3_f64_t point_b;
    
  • math_engine_geometry_query_result_t.normal

    Finite query normal; unit length when the query defines one.

    math_engine_vec3_f64_t normal;
    
  • math_engine_geometry_query_result_t.parameter_a

    Query-specific finite parameter for the first primitive.

    double parameter_a;
    
  • math_engine_geometry_query_result_t.parameter_b

    Query-specific finite parameter for the second primitive.

    double parameter_b;
    
  • math_engine_geometry_query_result_t.barycentric

    Triangle weights in (a,b,c) order; otherwise zero.

    double barycentric[3];
    
  • math_engine_geometry_query_result_t.signed_distance

    Signed gap/plane distance in the caller's length unit.

    double signed_distance;
    
  • math_engine_geometry_query_result_t.distance_squared

    Nonnegative squared witness distance in length units squared.

    double distance_squared;
    
  • math_engine_geometry_query_result_t.predicate_value

    Raw finite predicate value, such as orient3d.

    double predicate_value;
    
  • math_engine_geometry_query_result_t.predicate_error_bound

    Nonnegative absolute bound in predicate-value units.

    double predicate_error_bound;
    
  • math_engine_geometry_query_result_t.reserved

    Reserved words; written as 0.

    uint64_t reserved[2];
    

math_engine_geometry_handle_t

Neutral future extension handle. Zero is always invalid.

typedef uint64_t math_engine_geometry_handle_t;

math_engine_geometry_extension_info_t

Feature-off descriptor. Public data contains no native CAD or renderer type.

typedef struct math_engine_geometry_extension_info {
    uint32_t struct_size; /**< Caller-provided byte size; at least =sizeof= this version. */
    uint32_t struct_version; /**< =MATH_ENGINE_GEOMETRY_EXTENSION_INFO_VERSION_1=. */
    uint64_t available_capability_bits; /**< Bitwise =MATH_ENGINE_GEOMETRY_CAPABILITY_*= availability. */
    uint64_t available_backend_bits; /**< Bitwise optional =MATH_ENGINE_GEOMETRY_BACKEND_*= set. */
    uint32_t public_native_type_count; /**< Native backend types exposed by the C ABI; always 0. */
    uint32_t reserved32; /**< Reserved for ABI growth; written as 0. */
    uint64_t reserved[2]; /**< Reserved words; written as 0. */
} math_engine_geometry_extension_info_t;
  • math_engine_geometry_extension_info_t.struct_size

    Caller-provided byte size; at least sizeof this version.

    uint32_t struct_size;
    
  • math_engine_geometry_extension_info_t.struct_version

    MATH_ENGINE_GEOMETRY_EXTENSION_INFO_VERSION_1.

    uint32_t struct_version;
    
  • math_engine_geometry_extension_info_t.available_capability_bits

    Bitwise MATH_ENGINE_GEOMETRY_CAPABILITY_* availability.

    uint64_t available_capability_bits;
    
  • math_engine_geometry_extension_info_t.available_backend_bits

    Bitwise optional MATH_ENGINE_GEOMETRY_BACKEND_* set.

    uint64_t available_backend_bits;
    
  • math_engine_geometry_extension_info_t.public_native_type_count

    Native backend types exposed by the C ABI; always 0.

    uint32_t public_native_type_count;
    
  • math_engine_geometry_extension_info_t.reserved32

    Reserved for ABI growth; written as 0.

    uint32_t reserved32;
    
  • math_engine_geometry_extension_info_t.reserved

    Reserved words; written as 0.

    uint64_t reserved[2];
    

Macro와 constant

MATH_ENGINE_GEOMETRY_BACKEND_OCCT

Artifact includes the optional Open CASCADE Technology backend.

#define MATH_ENGINE_GEOMETRY_BACKEND_OCCT UINT64_C(0x00000001)

MATH_ENGINE_GEOMETRY_CAPABILITY_BEZIER

Artifact includes optional Bezier geometry support.

#define MATH_ENGINE_GEOMETRY_CAPABILITY_BEZIER UINT64_C(0x00000002)

MATH_ENGINE_GEOMETRY_CAPABILITY_BREP

Artifact includes optional boundary-representation support.

#define MATH_ENGINE_GEOMETRY_CAPABILITY_BREP UINT64_C(0x00000020)

MATH_ENGINE_GEOMETRY_CAPABILITY_MESH

Artifact includes optional mesh geometry support.

#define MATH_ENGINE_GEOMETRY_CAPABILITY_MESH UINT64_C(0x00000010)

MATH_ENGINE_GEOMETRY_CAPABILITY_NURBS

Artifact includes optional NURBS support.

#define MATH_ENGINE_GEOMETRY_CAPABILITY_NURBS UINT64_C(0x00000008)

MATH_ENGINE_GEOMETRY_CAPABILITY_SPLINE

Artifact includes optional polynomial spline support.

#define MATH_ENGINE_GEOMETRY_CAPABILITY_SPLINE UINT64_C(0x00000004)

MATH_ENGINE_GEOMETRY_CAPABILITY_STATIC_PRIMITIVES

Artifact provides allocation-free static primitive queries in this header.

#define MATH_ENGINE_GEOMETRY_CAPABILITY_STATIC_PRIMITIVES UINT64_C(0x00000001)

MATH_ENGINE_GEOMETRY_EXTENSION_INFO_VERSION_1

Initial layout version for math_engine_geometry_extension_info_t.

#define MATH_ENGINE_GEOMETRY_EXTENSION_INFO_VERSION_1 UINT32_C(1)

MATH_ENGINE_GEOMETRY_QUERY_RESULT_VERSION_1

math_engine_geometry_query_result_t 의 최초 안정 ABI version이다.

#define MATH_ENGINE_GEOMETRY_QUERY_RESULT_VERSION_1 UINT32_C(1)

Function

math_engine_closest_point_segment3_f64

Point에서 닫힌 line segment까지의 최근접점을 계산한다.

  • 매개변수 point: 입력 point.
  • 매개변수 segment_start: segment의 첫 끝점.
  • 매개변수 segment_end: segment의 둘째 끝점.
  • 매개변수 context: tolerance를 제공하는 borrowed context.
  • 매개변수 out_closest_point: 성공 시 최근접점을 받는 caller-owned storage.
  • 매개변수 out_segment_parameter: 성공 시 [0, 1] 구간 parameter를 받는 storage.
  • 반환: 성공 또는 음수 상태 code. 퇴화 segment는 시작점을 결과로 반환하며 성공한다. 실패 시 두 output은 변경하지 않는다.
  • Math Engine ownership: point=borrowed segment_start=borrowed segment_end=borrowed context=borrowed out_closest_point=caller out_segment_parameter=caller
  • Math Engine nullable: point=false segment_start=false segment_end=false context=false out_closest_point=false out_segment_parameter=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_closest_point_segment3_f64(
    const math_engine_vec3_f64_t* point,
    const math_engine_vec3_f64_t* segment_start,
    const math_engine_vec3_f64_t* segment_end,
    const math_engine_context_t* context,
    math_engine_vec3_f64_t* out_closest_point,
    double* out_segment_parameter);

math_engine_ray_sphere_intersection3_f64

제한된 ray parameter 구간에서 sphere와의 첫 교차를 계산한다.

  • 매개변수 ray: 입력 ray. Direction은 0이 아니어야 하며 정규화될 필요는 없다.
  • 매개변수 sphere: 입력 sphere.
  • 매개변수 parameter_min: 포함되는 최소 ray parameter.
  • 매개변수 parameter_max: 포함되는 최대 ray parameter이며 parameter_min 이상이어야 한다.
  • 매개변수 context: tolerance를 제공하는 borrowed context.
  • 매개변수 out_hit: 성공 시 교차 여부를 0 또는 1로 받는 storage.
  • 매개변수 out_parameter: 교차 시 첫 parameter를 받는 caller-owned storage.
  • 매개변수 out_point: 교차 시 point를 받는 caller-owned storage.
  • 반환: 계산 성공 또는 음수 상태 code. 교차가 없으면 성공하고 out_hit 만 0으로 기록한다. 오류 시 모든 output을, 비교차 성공 시 교차 결과 output을 보존한다.
  • Math Engine ownership: ray=borrowed sphere=borrowed context=borrowed out_hit=caller out_parameter=caller out_point=caller
  • Math Engine nullable: ray=false sphere=false context=false out_hit=false out_parameter=false out_point=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_ray_sphere_intersection3_f64(
    const math_engine_ray3_f64_t* ray,
    const math_engine_sphere3_f64_t* sphere,
    double parameter_min,
    double parameter_max,
    const math_engine_context_t* context,
    int32_t* out_hit,
    double* out_parameter,
    math_engine_vec3_f64_t* out_point);

math_engine_ray_plane_intersection3_f64

제한된 ray parameter 구간에서 plane과의 교차를 계산한다.

  • 매개변수 ray: 입력 ray. Direction은 0이 아니어야 하며 정규화될 필요는 없다.
  • 매개변수 plane: 입력 plane. Normal은 0이 아니어야 하며 정규화될 필요는 없다.
  • 매개변수 parameter_min: 포함되는 최소 ray parameter.
  • 매개변수 parameter_max: 포함되는 최대 ray parameter이며 parameter_min 이상이어야 한다.
  • 매개변수 context: tolerance를 제공하는 borrowed context.
  • 매개변수 out_hit: 성공 시 유일한 교차 여부를 0 또는 1로 받는 storage.
  • 매개변수 out_parameter: 교차 시 parameter를 받는 caller-owned storage.
  • 매개변수 out_point: 교차 시 point를 받는 caller-owned storage.
  • 반환: 계산 성공 또는 음수 상태 code. 평행하거나 ray 전체가 plane 위에 있으면 out_hit 은 0이다. 오류 시 모든 output을 보존한다.
  • Math Engine ownership: ray=borrowed plane=borrowed context=borrowed out_hit=caller out_parameter=caller out_point=caller
  • Math Engine nullable: ray=false plane=false context=false out_hit=false out_parameter=false out_point=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_ray_plane_intersection3_f64(
    const math_engine_ray3_f64_t* ray,
    const math_engine_plane3_f64_t* plane,
    double parameter_min,
    double parameter_max,
    const math_engine_context_t* context,
    int32_t* out_hit,
    double* out_parameter,
    math_engine_vec3_f64_t* out_point);

math_engine_sphere_sphere_toi3_f64

일정한 선형 속도로 이동하는 두 sphere의 최초 접촉 시간을 계산한다.

  • 매개변수 sphere_a: 시작 시각의 첫 sphere.
  • 매개변수 velocity_a: 첫 sphere의 초당 선형 속도.
  • 매개변수 sphere_b: 시작 시각의 둘째 sphere.
  • 매개변수 velocity_b: 둘째 sphere의 초당 선형 속도.
  • 매개변수 max_time_sec: 포함되는 비음수 예측 시간 상한(초).
  • 매개변수 context: tolerance를 제공하는 borrowed context.
  • 매개변수 out_hit: 성공 시 [0, max_time_sec] 안의 접촉 여부를 0 또는 1로 받는 storage.
  • 매개변수 out_time_sec: 접촉 시 최초 접촉 시간을 초 단위로 받는 caller-owned storage.
  • 반환: 계산 성공 또는 음수 상태 code. 처음부터 겹치거나 접하면 시간은 0이다. 오류 시 모든 output을, 비교차 성공 시 out_time_sec 을 보존한다.
  • Math Engine ownership: sphere_a=borrowed velocity_a=borrowed sphere_b=borrowed velocity_b=borrowed context=borrowed out_hit=caller out_time_sec=caller
  • Math Engine nullable: sphere_a=false velocity_a=false sphere_b=false velocity_b=false context=false out_hit=false out_time_sec=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_sphere_sphere_toi3_f64(
    const math_engine_sphere3_f64_t* sphere_a,
    const math_engine_vec3_f64_t* velocity_a,
    const math_engine_sphere3_f64_t* sphere_b,
    const math_engine_vec3_f64_t* velocity_b,
    double max_time_sec,
    const math_engine_context_t* context,
    int32_t* out_hit,
    double* out_time_sec);

math_engine_geometry_query_result_init

Static geometry query result를 version 1의 빈 결과로 초기화한다.

  • 매개변수 out_result: 초기화할 caller-owned result storage.
  • 반환: 유효한 storage면 OK, null이면 INVALID_ARGUMENT이며 실패하면 output을 보존한다.
  • Math Engine ownership: out_result=caller
  • Math Engine nullable: out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_geometry_query_result_init(
    math_engine_geometry_query_result_t* out_result);

math_engine_geometry_extension_info_get

Compile된 static/optional geometry 기능 경계를 보고한다.

  • 매개변수 out_info: caller가 struct_size 와 struct_version 을 설정한 output storage.
  • 반환: ABI header가 유효하면 OK, 크기·version·pointer가 잘못되면 해당 음수 상태 code이며 실패하면 output을 보존한다.

Base library는 static primitive만 보고하고 curve, mesh, B-rep와 OCCT bit는 0으로 둔다.

  • Math Engine ownership: out_info=caller
  • Math Engine nullable: out_info=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_geometry_extension_info_get(
    math_engine_geometry_extension_info_t* out_info);

math_engine_plane_project_point3_f64

Point를 plane에 투영하고 정규화된 signed distance를 반환한다.

  • 매개변수 point: 투영할 borrowed 3차원 point.
  • 매개변수 plane: normal과 offset으로 정의한 borrowed plane.
  • 매개변수 context: normal 퇴화와 relation 판정 tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 투영점과 signed distance를 받는 caller-owned result.
  • 반환: 유효한 plane이면 OK, null·non-finite·퇴화 normal이면 해당 음수 상태 code이며 실패하면 out_result 를 보존한다.
  • Math Engine ownership: point=borrowed plane=borrowed context=borrowed out_result=caller
  • Math Engine nullable: point=false plane=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_plane_project_point3_f64(
    const math_engine_vec3_f64_t* point,
    const math_engine_plane3_f64_t* plane,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_line_closest_point3_f64

무한 line 위에서 입력 point와 가장 가까운 점을 반환한다.

  • 매개변수 point: 거리 query의 borrowed point.
  • 매개변수 line: origin과 0이 아닌 direction으로 정의한 borrowed infinite line.
  • 매개변수 context: direction 퇴화 판정 tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 최근접점·line parameter·거리 제곱을 받는 caller-owned result.
  • 반환: 유효한 line이면 OK, null·non-finite·퇴화 direction이면 해당 음수 상태 code이며 실패하면 output을 보존한다.
  • Math Engine ownership: point=borrowed line=borrowed context=borrowed out_result=caller
  • Math Engine nullable: point=false line=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_line_closest_point3_f64(
    const math_engine_vec3_f64_t* point,
    const math_engine_line3_f64_t* line,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_ray_closest_point3_f64

Ray 위 최근접점을 구하고 음수 parameter를 0으로 clamp한다.

  • 매개변수 point: 거리 query의 borrowed point.
  • 매개변수 ray: origin과 0이 아닌 direction으로 정의한 borrowed ray.
  • 매개변수 context: direction 퇴화와 endpoint 판정 tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 최근접점·0 이상 parameter·feature를 받는 caller-owned result.
  • 반환: 유효한 ray이면 OK, null·non-finite·퇴화 direction이면 해당 음수 상태 code이며 실패하면 output을 보존한다.
  • Math Engine ownership: point=borrowed ray=borrowed context=borrowed out_result=caller
  • Math Engine nullable: point=false ray=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_ray_closest_point3_f64(
    const math_engine_vec3_f64_t* point,
    const math_engine_ray3_f64_t* ray,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_segment_segment_closest3_f64

두 닫힌 segment의 최근접점과 각 segment parameter를 반환한다.

  • 매개변수 segment_a: 첫 번째 borrowed closed segment.
  • 매개변수 segment_b: 두 번째 borrowed closed segment.
  • 매개변수 context: 평행·퇴화·접촉 판정 tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 두 최근접점과 [0,1] parameter를 받는 caller-owned result.
  • 반환: 유효한 입력이면 OK, null·non-finite 입력이면 해당 음수 상태 code이며 퇴화 segment도 점으로 처리한다. 실패하면 output을 보존한다.
  • Math Engine ownership: segment_a=borrowed segment_b=borrowed context=borrowed out_result=caller
  • Math Engine nullable: segment_a=false segment_b=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_segment_segment_closest3_f64(
    const math_engine_segment3_f64_t* segment_a,
    const math_engine_segment3_f64_t* segment_b,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_aabb_closest_point3_f64

AABB 표면 또는 내부에서 입력 point와 가장 가까운 점을 반환한다.

  • 매개변수 point: 거리 query의 borrowed point.
  • 매개변수 box: 축별 minimum/maximum으로 정의한 borrowed AABB.
  • 매개변수 context: 경계 relation tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 clamp된 점·feature·거리 제곱을 받는 caller-owned result.
  • 반환: minimum이 maximum 이하인 finite box면 OK, 아니면 해당 음수 상태 code이며 실패하면 output을 보존한다.
  • Math Engine ownership: point=borrowed box=borrowed context=borrowed out_result=caller
  • Math Engine nullable: point=false box=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_aabb_closest_point3_f64(
    const math_engine_vec3_f64_t* point,
    const math_engine_aabb3_f64_t* box,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_triangle_closest_point3_f64

Triangle 최근접점과 (a,b,c) 순서 barycentric weight를 반환한다.

  • 매개변수 point: 거리 query의 borrowed point.
  • 매개변수 triangle: 순서 있는 세 vertex를 가진 borrowed triangle.
  • 매개변수 context: triangle 퇴화와 feature 판정 tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 최근접점·barycentric weight·feature를 받는 caller-owned result.
  • 반환: 유효한 비퇴화 triangle이면 OK, null·non-finite·퇴화 입력이면 해당 음수 상태 code이며 실패하면 output을 보존한다.
  • Math Engine ownership: point=borrowed triangle=borrowed context=borrowed out_result=caller
  • Math Engine nullable: point=false triangle=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_triangle_closest_point3_f64(
    const math_engine_vec3_f64_t* point,
    const math_engine_triangle3_f64_t* triangle,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_ray_triangle_intersection3_f64

제한된 ray parameter 구간과 순서 있는 triangle의 교차를 계산한다.

  • 매개변수 ray: origin과 0이 아닌 direction으로 정의한 borrowed ray.
  • 매개변수 triangle: winding이 normal 방향을 정하는 borrowed triangle.
  • 매개변수 parameter_min: 포함되는 finite ray parameter 하한.
  • 매개변수 parameter_max: 포함되는 finite 상한이며 하한 이상이어야 한다.
  • 매개변수 context: 평행·edge·predicate 판정 tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 hit/miss, parameter, point와 barycentric을 받는 caller-owned result.
  • 반환: query가 유효하면 hit와 miss 모두 OK, 잘못되거나 퇴화한 입력은 해당 음수 상태 code이며 실패하면 output을 보존한다.

Coplanar ray는 유일한 hit가 없으므로 COPLANAR 과 MISS 를 함께 기록한다. 양쪽 face orientation을 허용하고 반환 unit normal은 triangle winding을 따른다.

  • Math Engine ownership: ray=borrowed triangle=borrowed context=borrowed out_result=caller
  • Math Engine nullable: ray=false triangle=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_ray_triangle_intersection3_f64(
    const math_engine_ray3_f64_t* ray,
    const math_engine_triangle3_f64_t* triangle,
    double parameter_min,
    double parameter_max,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_aabb_aabb_relation3_f64

두 AABB를 disjoint, touching, overlapping 또는 contained로 분류한다.

  • 매개변수 box_a: 첫 번째 borrowed finite AABB.
  • 매개변수 box_b: 두 번째 borrowed finite AABB.
  • 매개변수 context: 접촉과 포함 relation tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 relation, signed gap과 witness point를 받는 caller-owned result.
  • 반환: 두 box가 유효하면 OK, null·non-finite·역전 bound이면 해당 음수 상태 code이며 실패하면 output을 보존한다.
  • Math Engine ownership: box_a=borrowed box_b=borrowed context=borrowed out_result=caller
  • Math Engine nullable: box_a=false box_b=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_aabb_aabb_relation3_f64(
    const math_engine_aabb3_f64_t* box_a,
    const math_engine_aabb3_f64_t* box_b,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_sphere_sphere_relation3_f64

두 sphere relation을 분류하고 표면 최근접점과 signed gap을 반환한다.

  • 매개변수 sphere_a: 첫 번째 borrowed finite sphere.
  • 매개변수 sphere_b: 두 번째 borrowed finite sphere.
  • 매개변수 context: 접촉·중심 일치 판정 tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 relation, witness point, normal과 signed gap을 받는 caller-owned result.
  • 반환: 두 radius가 비음수이고 입력이 finite면 OK, 아니면 해당 음수 상태 code이며 실패하면 output을 보존한다.
  • Math Engine ownership: sphere_a=borrowed sphere_b=borrowed context=borrowed out_result=caller
  • Math Engine nullable: sphere_a=false sphere_b=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_sphere_sphere_relation3_f64(
    const math_engine_sphere3_f64_t* sphere_a,
    const math_engine_sphere3_f64_t* sphere_b,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);

math_engine_orient3d_f64

Oriented tetrahedron predicate orient3d(a,b,c,d) 를 평가한다.

  • 매개변수 a: oriented base triangle의 첫 borrowed point.
  • 매개변수 b: oriented base triangle의 둘째 borrowed point.
  • 매개변수 c: oriented base triangle의 셋째 borrowed point.
  • 매개변수 d: base plane에 대해 부호를 판정할 borrowed point.
  • 매개변수 context: mode와 near-zero refinement tolerance를 제공하는 borrowed context.
  • 매개변수 out_result: 성공 시 predicate 값·오차 bound·orientation·certainty를 받는 result.
  • 반환: finite 입력이면 OK, null·non-finite이면 해당 음수 상태 code이며 실패하면 out_result 를 보존한다.

Game Fast는 bound 안의 near-zero를 UNCERTAIN 으로 보고한다. PC Precision과 FULL은 같은 경계에서 long double로 refine하고 REFINED 를 보고한다.

  • Math Engine ownership: a=borrowed b=borrowed c=borrowed d=borrowed context=borrowed out_result=caller
  • Math Engine nullable: a=false b=false c=false d=false context=false out_result=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_orient3d_f64(
    const math_engine_vec3_f64_t* a,
    const math_engine_vec3_f64_t* b,
    const math_engine_vec3_f64_t* c,
    const math_engine_vec3_f64_t* d,
    const math_engine_context_t* context,
    math_engine_geometry_query_result_t* out_result);