minimc 0.5.1
Loading...
Searching...
No Matches
CSGSurface Class Referenceabstract

A surface to be used in constructive solid geometry. More...

#include <CSGSurface.hpp>

Inheritance diagram for CSGSurface:

Public Member Functions

virtual ~CSGSurface () noexcept
 Virtual destructor (C++ Core Guidelines C.127)
 
virtual bool Contains (const Point &p) const noexcept=0
 Returns true if Point is in the "negative" side of the (open) surface. A point on the surface or outside is considered to be on the "positive" side. More...
 
virtual Real Distance (const Point &origin, const Direction &direction) const noexcept=0
 Return the distance from a given origin Point to the CSGSurface along a given Direction. More...
 

Static Public Member Functions

static std::unique_ptr< const CSGSurfaceCreate (const pugi::xml_node &root, const std::string &name)
 Factory method to create new CSGSurface from an XML document. More...
 

Public Attributes

const std::string name
 Unique, user-defined identifier (C++ Core Guidelines C.131)
 

Protected Member Functions

 CSGSurface (const pugi::xml_node &surface_node) noexcept
 Constructs a CSGSurface from a surface node of an XML document. More...
 

Static Protected Member Functions

static Real SolveQuadratic (Real a, Real b, Real c) noexcept
 Specialized form of quadratic equation solver. More...
 

Detailed Description

A surface to be used in constructive solid geometry.

Constructor & Destructor Documentation

◆ CSGSurface()

CSGSurface::CSGSurface ( const pugi::xml_node &  surface_node)
protectednoexcept

Constructs a CSGSurface from a surface node of an XML document.

Parameters
surface_nodeThe requested surface node in the XML document

Member Function Documentation

◆ Contains()

virtual bool CSGSurface::Contains ( const Point p) const
pure virtualnoexcept

Returns true if Point is in the "negative" side of the (open) surface. A point on the surface or outside is considered to be on the "positive" side.

Implemented in Sphere, PlaneX, and CylinderX.

◆ Create()

static std::unique_ptr< const CSGSurface > CSGSurface::Create ( const pugi::xml_node &  root,
const std::string &  name 
)
static

Factory method to create new CSGSurface from an XML document.

Parameters
rootRoot node of existing XML document
nameName of the CSGSurface in the XML document
Returns
A std::unique_ptr to the constructed CSGSurface (C++ Core Guidelines R.30)
Exceptions
std::runtime_error`surface` node with matching `name` attribute not found

◆ Distance()

virtual Real CSGSurface::Distance ( const Point origin,
const Direction direction 
) const
pure virtualnoexcept

Return the distance from a given origin Point to the CSGSurface along a given Direction.

Returns
A positive finite distance if Direction is pointed towards the CSGSurface, otherwise positive infinity

Implemented in Sphere, PlaneX, and CylinderX.

◆ SolveQuadratic()

static Real CSGSurface::SolveQuadratic ( Real  a,
Real  b,
Real  c 
)
staticprotectednoexcept

Specialized form of quadratic equation solver.

Used for CSGSurface intersection distance calculations. Returns least positive real solution if it exists; infinity otherwise.


The documentation for this class was generated from the following file: