C++ API Reference¶
The C++ API provides the core functionality for lossless range image generation and reconstruction. All symbols are in the alice_lri namespace.
Main Functions¶
Common entry points for intrinsics estimation, projection, and reconstruction.
Intrinsics Estimation¶
-
Result<Intrinsics> alice_lri::estimateIntrinsics(const PointCloud::Float &points) noexcept¶
Estimate sensor intrinsics from a float point cloud.
- Parameters:
points – Input point cloud (float precision).
- Returns:
Result containing estimated Intrinsics or error status.
-
Result<Intrinsics> alice_lri::estimateIntrinsics(const PointCloud::Double &points) noexcept¶
Estimate sensor intrinsics from a double point cloud.
- Parameters:
points – Input point cloud (double precision).
- Returns:
Result containing estimated Intrinsics or error status.
Range Image Projection¶
-
Result<RangeImage> alice_lri::projectToRangeImage(const Intrinsics &intrinsics, const PointCloud::Float &points) noexcept¶
Project a point cloud to a range image using given intrinsics (float).
- Parameters:
intrinsics – Sensor intrinsics.
points – Input point cloud (float precision).
- Returns:
Result containing RangeImage or error status.
-
Result<RangeImage> alice_lri::projectToRangeImage(const Intrinsics &intrinsics, const PointCloud::Double &points) noexcept¶
Project a point cloud to a range image using given intrinsics (double).
- Parameters:
intrinsics – Sensor intrinsics.
points – Input point cloud (double precision).
- Returns:
Result containing RangeImage or error status.
Point Cloud Reconstruction¶
-
PointCloud::Double alice_lri::unProjectToPointCloud(const Intrinsics &intrinsics, const RangeImage &rangeImage) noexcept¶
Unproject a range image to a double point cloud using given intrinsics.
- Parameters:
intrinsics – Sensor intrinsics.
rangeImage – Input range image.
- Returns:
Unprojected point cloud (double precision).
Main Data Structures¶
Core types for working with intrinsics, range images, and point clouds.
-
struct Intrinsics¶
Contains intrinsic parameters for a sensor, including all scanlines.
Public Functions
-
inline explicit Intrinsics(const int32_t scanlineCount) noexcept¶
Constructs Intrinsics with a given number of scanlines.
- Parameters:
scanlineCount – Number of scanlines.
Public Members
-
AliceArray<Scanline> scanlines¶
Array of scanlines describing the sensor geometry.
-
inline explicit Intrinsics(const int32_t scanlineCount) noexcept¶
-
struct RangeImage¶
Represents a 2D range image with pixel data.
Public Functions
-
inline RangeImage() noexcept¶
Default constructor (empty image).
-
inline RangeImage(const uint32_t w, const uint32_t h) noexcept¶
Construct with width and height. Reserves space for pixels but does not initialize them.
- Parameters:
w – Image width
h – Image height
-
inline RangeImage(const uint32_t w, const uint32_t h, const double initialValue) noexcept¶
Construct with width, height, and initial pixel value.
- Parameters:
w – Image width
h – Image height
initialValue – Initial value for all pixels
-
inline double &operator()(const uint32_t row, const uint32_t col) noexcept¶
Access pixel at (row, col).
-
inline const double &operator()(const uint32_t row, const uint32_t col) const noexcept¶
Access pixel at (row, col) (const).
-
inline uint32_t width() const noexcept¶
- Returns:
Image width.
-
inline uint32_t height() const noexcept¶
- Returns:
Image height.
-
inline uint64_t size() const noexcept¶
- Returns:
Total number of pixels.
-
inline const double *data() const noexcept¶
- Returns:
Pointer to pixel data (const).
-
inline double *data() noexcept¶
- Returns:
Pointer to pixel data.
-
inline RangeImage() noexcept¶
-
struct Scanline¶
Represents a single scanline with intrinsic parameters.
Public Members
-
double verticalOffset¶
Vertical spatial offset of the scanline.
-
double verticalAngle¶
Vertical angle of the scanline.
-
double horizontalOffset¶
Horizontal spatial offset of the scanline.
-
double azimuthalOffset¶
Azimuthal offset of the scanline.
-
int32_t resolution¶
Horizontal resolution of the scanline.
-
double verticalOffset¶
Point Cloud Types¶
-
struct Float¶
3D point cloud with float precision.
Public Functions
-
inline void reserve(const uint64_t count)¶
Reserve memory for a given number of points.
- Parameters:
count – Number of points to reserve.
Public Members
-
AliceArray<float> x¶
X coordinates.
-
AliceArray<float> y¶
Y coordinates.
-
AliceArray<float> z¶
Z coordinates.
-
inline void reserve(const uint64_t count)¶
-
struct Double¶
3D point cloud with double precision.
Public Functions
-
inline void reserve(const uint64_t count)¶
Reserve memory for a given number of points.
- Parameters:
count – Number of points to reserve.
Public Members
-
AliceArray<double> x¶
X coordinates.
-
AliceArray<double> y¶
Y coordinates.
-
AliceArray<double> z¶
Z coordinates.
-
inline void reserve(const uint64_t count)¶
Result Type¶
The main API functions return Result<T> to handle success and error cases.
-
template<class T>
class Result¶ Result type for operations that may fail, containing either a value or a status.
- Template Parameters:
T – Type of the value.
Public Functions
-
inline explicit Result(const T &v) noexcept¶
Construct a Result with a value.
- Parameters:
v – The value.
-
inline explicit Result(T &&v) noexcept¶
Construct a Result with a value (move).
- Parameters:
v – The value (rvalue).
-
inline explicit Result(const Status &s) noexcept¶
Construct a Result with a status.
- Parameters:
s – The status.
-
inline explicit Result(Status &&s) noexcept¶
Construct a Result with a status (move).
- Parameters:
s – The status (rvalue).
-
inline ~Result()¶
Destructor.
-
inline bool ok() const noexcept¶
Check if the result is ok (has value).
- Returns:
True if value is present.
-
inline explicit operator bool() const noexcept¶
Check if result is ok (implicit conversion).
- Returns:
True if value is present.
Utility Classes¶
AliceArray¶
-
template<class T>
class AliceArray¶ Dynamic array implementation for Alice LRI library.
This class provides a dynamic array with explicit memory management and ABI compatibility. It avoids std::vector to prevent ABI boundary issues when used across library boundaries.
- Template Parameters:
T – Element type.
Public Functions
-
AliceArray() noexcept = default¶
Default constructor.
-
inline explicit AliceArray(uint64_t n) noexcept¶
Construct with n default-initialized elements.
- Parameters:
n – Number of elements.
-
inline AliceArray(uint64_t n, const T &initialValue) noexcept¶
Construct with n elements, all set to initialValue.
- Parameters:
n – Number of elements.
initialValue – Value to assign.
-
inline AliceArray(const T *data, uint64_t n) noexcept¶
Construct from raw data pointer and size.
- Parameters:
data – Pointer to data.
n – Number of elements.
-
inline AliceArray(const AliceArray &other) noexcept¶
Copy constructor.
-
template<typename U>
inline AliceArray(std::initializer_list<U> init) noexcept¶ Construct from initializer list.
- Template Parameters:
U – Type of initializer list elements.
- Parameters:
init – Initializer list.
-
inline AliceArray &operator=(const AliceArray &other) noexcept¶
Copy assignment.
-
inline AliceArray(AliceArray &&other) noexcept¶
Move constructor.
-
inline AliceArray &operator=(AliceArray &&other) noexcept¶
Move assignment.
-
inline ~AliceArray() noexcept¶
Destructor.
-
inline uint64_t size() const noexcept¶
- Returns:
Number of elements.
-
inline bool empty() const noexcept¶
- Returns:
True if array is empty.
-
inline uint64_t capacity() const noexcept¶
- Returns:
Allocated capacity.
-
inline void push_back(const T &value) noexcept¶
Add an element to the end.
- Parameters:
value – Value to add.
-
inline void emplace_back(const T &value) noexcept¶
Add an element to the end (alias for push_back).
- Parameters:
value – Value to add.
-
inline void resize(uint64_t n) noexcept¶
Resize the array to n elements.
- Parameters:
n – New size.
-
inline void reserve(uint64_t n) noexcept¶
Reserve memory for at least n elements.
- Parameters:
n – Number of elements.
-
inline void shrink_to_fit() noexcept¶
Shrink capacity to fit size.
-
inline void clear() noexcept¶
Clear the array, destroying all elements.
AliceString¶
-
class AliceString¶
String class for Alice LRI library. Owns its data, is mutable, and always null-terminated.
This class is a thin PIMPL wrapper around std::string, providing explicit memory management and ABI compatibility.
Public Functions
-
AliceString() noexcept¶
Default constructor. Creates an empty string.
-
explicit AliceString(const char *c_str) noexcept¶
Construct from a null-terminated C string.
- Parameters:
c_str – Null-terminated C string (may be nullptr for empty).
-
AliceString(const char *data, uint64_t n) noexcept¶
Construct from a data pointer and length.
- Parameters:
data – Pointer to character data (may be nullptr for empty).
n – Number of characters to copy from data.
-
AliceString(const AliceString &other) noexcept¶
Copy constructor. Deep copy of the string.
- Parameters:
other – String to copy from.
-
AliceString &operator=(const AliceString &other) noexcept¶
Copy assignment. Deep copy of the string.
- Parameters:
other – String to copy from.
- Returns:
Reference to this string.
-
AliceString(AliceString &&other) noexcept¶
Move constructor. Transfers ownership.
- Parameters:
other – String to move from.
-
AliceString &operator=(AliceString &&other) noexcept¶
Move assignment. Transfers ownership.
- Parameters:
other – String to move from.
- Returns:
Reference to this string.
-
AliceString &operator=(const char *c_str) noexcept¶
Assign from a null-terminated C string.
- Parameters:
c_str – Null-terminated C string (may be nullptr for empty).
- Returns:
Reference to this string.
-
~AliceString() noexcept¶
Destructor. Releases owned memory.
-
uint64_t size() const noexcept¶
Get the number of characters in the string.
- Returns:
String size (number of characters, not including null terminator).
-
const char *c_str() const noexcept¶
Get a pointer to the null-terminated C string.
- Returns:
Pointer to null-terminated character data (never nullptr).
-
bool empty() const noexcept¶
Check if the string is empty.
- Returns:
True if the string is empty.
-
char &operator[](uint64_t i) noexcept¶
Access character at index.
- Parameters:
i – Index of character (no bounds check).
- Returns:
Reference to character.
-
const char &operator[](uint64_t i) const noexcept¶
Access character at index (const).
- Parameters:
i – Index of character (no bounds check).
- Returns:
Const reference to character.
-
inline char *begin() noexcept¶
Iterator to beginning of string data.
- Returns:
Pointer to first character.
-
inline char *end() noexcept¶
Iterator to end of string data.
- Returns:
Pointer one past the last character.
-
inline const char *begin() const noexcept¶
Const iterator to beginning of string data.
- Returns:
Pointer to first character.
-
inline const char *end() const noexcept¶
Const iterator to end of string data.
- Returns:
Pointer one past the last character.
-
void clear() noexcept¶
Clear the string, making it empty.
-
void reserve(uint64_t n) noexcept¶
Reserve memory for at least n characters.
- Parameters:
n – Minimum capacity to reserve.
-
void shrink_to_fit() noexcept¶
Shrink capacity to fit the current size.
-
void resize(uint64_t n, char fill = '\0') noexcept¶
Resize the string to n characters, filling with fill if needed.
- Parameters:
n – New size.
fill – Character to use for new elements (default ‘\0’).
-
void push_back(char ch) noexcept¶
Append a character to the end of the string.
- Parameters:
ch – Character to append.
-
void append(const char *c_str) noexcept¶
Append a null-terminated C string.
- Parameters:
c_str – Null-terminated C string (may be nullptr for no-op).
-
void append(const char *data, uint64_t n) noexcept¶
Append data from a pointer and length.
- Parameters:
data – Pointer to data (may be nullptr for no-op).
n – Number of characters to append.
-
void append(const AliceString &other) noexcept¶
Append another AliceString.
- Parameters:
other – String to append.
-
AliceString() noexcept¶
Additional Resources¶
Advanced C++ API - Detailed intrinsics, error handling, JSON I/O, and advanced utilities