geomc 1.0
A c++ linear algebra template library
Loading...
Searching...
No Matches
Similar< Shape > Class Template Reference

A shape transformed by a similarity transform (translation, rotation, and scale). More...

#include <geomc/shape/Similar.h>

Inheritance diagram for Similar< Shape >:
Dimensional< Shape::elem_t, Shape::N >

Public Types

using elem_t = typename Shape::elem_t
using point_t
 The type of a point in this object's space.
using T = elem_t

Public Member Functions

 Similar ()
 Wrap a default-constructed shape with the identity transform.
 Similar (const Shape &shape)
 Wrap a shape with an identity transform.
 Similar (const Shape &shape, const Similarity< T, N > &xf)
 Wrap a shape with a similarity transform.
Rect< T, N > bounds () const
 Compute the axis-aligned bounding box of the shape.
Vec< T, N > clip (Vec< T, N > p) const
 Nearest point on the interior of the shape.
bool contains (typename Shape::point_t p) const
 Shape-point intersection test.
Vec< T, N > convex_support (Vec< T, N > d) const
Vec< T, N > corner (index_t i) const
Rect< T, 1 > intersect (const Ray< T, N > &ray) const
 Ray-shape intersection.
template<ConvexObject S>
bool intersects (const S &other) const
template<typename S>
requires requires (Similarity<T,N> xf, const Shape s, const S b) { s.intersects(b); { b / xf } -> std::same_as<S>; }
bool intersects (const S &s) const
 Intersection with another shape. Available if the other shape can be transformed into our space while preserving its type.
template<typename S>
requires requires (const Similar<Shape> s, const S b) { s.intersects(b); }
bool intersects (const Similar< S > &s) const
 Intersecion with another similar shape. Available if our shape can intersect the other shape's base shape.
measure_boundary () const
 Measure the boundary (surface area) of the shape.
measure_interior () const
 Measure the interior (volume) of the shape.
Vec< T, N > normal (Vec< T, N > p) const
 Direction away from the surface of the shape at point p.
 operator Transformed< Shape > () const
 Convert this shape to a Transformed shape.
bool operator== (const Similar &other) const
Vec< T, N > project (Vec< T, N > p) const
 Orthogonally project p to the surface of this shape.
sdf (Vec< T, N > p) const
 Signed distance function.
Similar< Rect< T, N > > transformed_bounds () const

Static Public Member Functions

static constexpr bool admits_cusps ()

Public Attributes

Shape shape
 Un-transformed shape.
Similarity< T, N > xf

Static Public Attributes

static constexpr index_t N = Shape::N

(Note that these are not member symbols.)

template<typename T, index_t N>
using Box = Similar<Rect<T,N>>
 Convenience typedef for arbitrarily-oriented Rects.
template<typename Shape>
Similar< Shape > operator* (const Similarity< typename Shape::elem_t, Shape::N > &xf, const Shape &shape)
 Transform the shape shape by wrapping it with a Similarity transform.
template<typename Shape>
Similar< Shape > operator* (const Similarity< typename Shape::elem_t, Shape::N > &xf, const Similar< Shape > &s)
 Transform the shape s by xf.
template<typename Shape>
Similar< Shape > & operator*= (Similar< Shape > &s, const Similarity< typename Shape::elem_t, Shape::N > &xf)
 In-place transform the shape s by xf.
template<typename Shape>
Similar< Shape > operator/ (const Shape &s, const Similarity< typename Shape::elem_t, Shape::N > &xf)
 Transform the shape s by the inverse of xf.
template<typename Shape>
Similar< Shape > operator/ (const Similar< Shape > &s, const Similarity< typename Shape::elem_t, Shape::N > &xf)
 Transform the shape s by the inverse of xf.
template<typename Shape>
Similar< Shape > & operator/= (Similar< Shape > &s, const Similarity< typename Shape::elem_t, Shape::N > &xf)
 In-place transform the shape s by the inverse of xf.

Detailed Description

template<typename Shape>
class geom::Similar< Shape >

A shape transformed by a similarity transform (translation, rotation, and scale).

Similar transfrorms guarantee that shapes and relative distances are preserved. For arbitrarily-transformed shapes, see Transformed.

Member Typedef Documentation

◆ point_t

using point_t
inherited

The type of a point in this object's space.

An N-vector of T if N > 1, otherwise a T.

Member Function Documentation

◆ convex_support()

template<typename Shape>
Vec< T, N > convex_support ( Vec< T, N > d) const
inline

Convex support function. Return the point on the surface of the shape which is farthest in the direction d.


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