-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.h
More file actions
83 lines (73 loc) · 2.79 KB
/
interface.h
File metadata and controls
83 lines (73 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#include <cstddef>
#include <cstdint>
extern "C" {
/**
* @brief Opaque AABB structure (treat as pointer).
*/
struct Aabb64;
/**
* @brief Column-major 4x4 affine transformation matrix.
*/
using Matrix4x4 = double[4][4];
/**
* @brief Status codes for AABB operations.
*/
enum class Status : uint32_t {
Success = 0, ///< Operation completed successfully.
NullPointer, ///< Provided pointer was null.
InvalidPointerAlignment, ///< Pointer was not properly aligned.
InsufficientBufferSize, ///< Buffer size is incorrect (too small).
InvalidByteStride ///< Byte stride does not have required alignment.
};
/**
* @brief Return the byte size and alignment of the AABB state buffer.
* @param[out] out_buffer_size Pointer to store buffer size.
* @param[out] out_buffer_alignment Pointer to store buffer alignment.
* @return Status::Success or error code.
*/
Status aabb_buffer_info(std::size_t* out_buffer_size, std::size_t* out_buffer_alignment);
/**
* @brief Initialize the AABB structure.
* @param[in,out] aabb Pointer to AABB structure.
* @param[in] aabb_size Size of AABB structure (must be at least value from aabb_buffer_info).
* @return Status::Success or error code.
*/
Status aabb_init(Aabb64* aabb, std::size_t aabb_size);
/**
* @brief Incrementally compute the AABB for a set of points transformed by a given affine transformation.
* This function is cumulative and can be called multiple times.
* @param[in,out] aabb Pointer to AABB structure.
* @param[in] aabb_size Size of AABB structure (must be at least value from aabb_buffer_info).
* @param[in] transform Pointer to 4x4 column-major affine transformation matrix.
* @param[in] first_point Pointer to first point in array.
* @param[in] point_count Number of points in array.
* @param[in] point_byte_stride Byte stride between points (must be 4-byte aligned).
* @return Status::Success or error code.
*/
Status aabb_compute_incremental(
Aabb64* aabb,
std::size_t aabb_size,
const Matrix4x4* transform,
const void* first_point,
std::size_t point_count,
std::size_t point_byte_stride
);
/**
* @brief Get the current min and max values of the AABB.
* Can be called after any number of incremental computations.
* @param[in] aabb Pointer to AABB structure.
* @param[in] aabb_size Size of AABB structure (must be at least value from aabb_buffer_info).
* @param[out] out_min Pointer to store min vector.
* @param[out] out_max Pointer to store max vector.
* @param[in] out_buffer_size Size of output buffers (must be at least 24 bytes).
* @return Status::Success or error code.
*/
Status aabb_result(
const Aabb64* aabb,
std::size_t aabb_size,
void* out_min,
void* out_max,
std::size_t out_buffer_size
);
} // extern "C"