PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
Primitive.h File Reference

This file defines primitive SDF shapes. More...

#include "TypeDefs.h"
#include "pbat/HostDevice.h"
#include "pbat/common/Concepts.h"
#include "pbat/math/linalg/mini/Mini.h"
#include <algorithm>
#include <cmath>

Go to the source code of this file.

Classes

struct  pbat::geometry::sdf::Primitive
 Base struct for all primitive shapes. More...
 
struct  pbat::geometry::sdf::Sphere< TScalar >
 Sphere centered in \( (0,0,0) \) with radius \( R \). More...
 
struct  pbat::geometry::sdf::Box< TScalar >
 Axis-aligned box centered in \( (0,0,0) \) with half extents \( \text{he} \in \mathbb{R}^3 \). More...
 
struct  pbat::geometry::sdf::BoxFrame< TScalar >
 Box frame with half extents \( \text{he} \in \mathbb{R}^3 \) and thickness \( t \). More...
 
struct  pbat::geometry::sdf::Torus< TScalar >
 Torus centered in \( (0,0,0) \) with minor+major radius \( t = (r,R) \). More...
 
struct  pbat::geometry::sdf::CappedTorus< TScalar >
 Capped torus centered in \( (0,0,0) \) with parameters sc, ra, rb. More...
 
struct  pbat::geometry::sdf::Link< TScalar >
 Link shape as elongated torus with elongation length \( le \) and minor+major radius \(t = (r,R) \). More...
 
struct  pbat::geometry::sdf::InfiniteCylinder< TScalar >
 Infinite cylinder. More...
 
struct  pbat::geometry::sdf::Cone< TScalar >
 Cone shape. More...
 
struct  pbat::geometry::sdf::InfiniteCone< TScalar >
 Infinite cone shape. More...
 
struct  pbat::geometry::sdf::Plane< TScalar >
 Plane shape with normal \( n=(0,0,1) \) and point on the plane \( o=(0,0,0) \). More...
 
struct  pbat::geometry::sdf::HexagonalPrism< TScalar >
 Hexagonal prism shape. More...
 
struct  pbat::geometry::sdf::Capsule< TScalar >
 Capsule shape with endpoints \( a, b \in \mathbb{R}^3 \) and radius \( r \). More...
 
struct  pbat::geometry::sdf::VerticalCapsule< TScalar >
 Capsule shape with height \( h \) and radius \( r \). More...
 
struct  pbat::geometry::sdf::CappedCylinder< TScalar >
 Capped cylinder shape with endpoints \( a, b \in \mathbb{R}^3 \) and radius \( r \). More...
 
struct  pbat::geometry::sdf::VerticalCappedCylinder< TScalar >
 Vertical capped cylinder shape with height \( h \) and radius \( r \). More...
 
struct  pbat::geometry::sdf::RoundedCylinder< TScalar >
 Rounded cylinder shape with height \( h \), radius \( \text{ra} \) and rounding radius \( \text{rb} \). More...
 
struct  pbat::geometry::sdf::VerticalCappedCone< TScalar >
 Capped cone shape with height \( h \) and minor+major radius \( r^1, r^2 \). More...
 
struct  pbat::geometry::sdf::CutHollowSphere< TScalar >
 Cut hollow sphere shape with radius \( r \), cut height \( h \) and thickness \( t \). More...
 
struct  pbat::geometry::sdf::VerticalRoundCone< TScalar >
 Vertical round cone shape with height \( h \), radii \( \text{r}^1, \text{r}^2 \) at endpoints. More...
 
struct  pbat::geometry::sdf::Octahedron< TScalar >
 Octahedron shape. More...
 
struct  pbat::geometry::sdf::Pyramid< TScalar >
 Pyramid shape. More...
 
struct  pbat::geometry::sdf::Triangle< TScalar >
 Triangle shape. More...
 
struct  pbat::geometry::sdf::Quadrilateral< TScalar >
 Quadrilateral shape with vertices \( a, b, c, d \in \mathbb{R}^3 \). More...
 

Namespaces

namespace  pbat
 The main namespace of the library.
 
namespace  pbat::geometry
 Geometric queries, quantities and data structures.
 
namespace  pbat::geometry::sdf
 Namespace for signed distance functions (SDFs) and related operations.
 

Functions

template<common::CArithmetic TScalar>
TScalar pbat::geometry::sdf::sign (TScalar x)
 Sign function, i.e. \( \text{sign}(x) = +1 \text{ if } x > 0, -1 \text{ if } x < 0, 0 \text{ if } x = 0 \).
 

Detailed Description

This file defines primitive SDF shapes.

Author
Quoc-Minh Ton-That (tonth.nosp@m.at.q.nosp@m.uocmi.nosp@m.nh@g.nosp@m.mail..nosp@m.com)
Version
0.1
Date
2025-09-16

Credits go to https://iquilezles.org/articles/distfunctions/, thank you Inigo Quilez!