Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
libnest2d::RotatedBox< Pt, Unit > Class Template Reference

#include <src/libnest2d/include/libnest2d/utils/rotcalipers.hpp>

Public Member Functions

 RotatedBox ()=default
 
 RotatedBox (const Pt &axis, Unit b, Unit r)
 
long double area () const
 
long double width () const
 
long double height () const
 
Unit bottom_extent () const
 
Unit right_extent () const
 
const Pt & axis () const
 
Radians angleToX () const
 

Private Attributes

Pt axis_
 
Unit bottom_ = Unit(0)
 
Unit right_ = Unit(0)
 

Detailed Description

template<class Pt, class Unit = TCompute<Pt>>
class libnest2d::RotatedBox< Pt, Unit >

Constructor & Destructor Documentation

◆ RotatedBox() [1/2]

template<class Pt , class Unit = TCompute<Pt>>
libnest2d::RotatedBox< Pt, Unit >::RotatedBox ( )
default

◆ RotatedBox() [2/2]

template<class Pt , class Unit = TCompute<Pt>>
libnest2d::RotatedBox< Pt, Unit >::RotatedBox ( const Pt &  axis,
Unit  b,
Unit  r 
)
inline
19 :
20 axis_(axis), bottom_(b), right_(r) {}
Pt axis_
Definition rotcalipers.hpp:14
Unit bottom_
Definition rotcalipers.hpp:15
const Pt & axis() const
Definition rotcalipers.hpp:37
Unit right_
Definition rotcalipers.hpp:15

Member Function Documentation

◆ angleToX()

template<class Pt , class Unit = TCompute<Pt>>
Radians libnest2d::RotatedBox< Pt, Unit >::angleToX ( ) const
inline
39 {
40 double ret = std::atan2(getY(axis_), getX(axis_));
41 auto s = std::signbit(ret);
42 if(s) ret += Pi_2;
43 return -ret;
44 }
TCoord< P > getX(const P &p)
Definition geometry_traits.hpp:424
TCoord< P > getY(const P &p)
Definition geometry_traits.hpp:427
const double BP2D_CONSTEXPR Pi_2
Definition common.hpp:98

References libnest2d::RotatedBox< Pt, Unit >::axis_, libnest2d::getX(), libnest2d::getY(), and libnest2d::Pi_2.

Referenced by libnest2d::fitIntoBoxRotation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ area()

template<class Pt , class Unit = TCompute<Pt>>
long double libnest2d::RotatedBox< Pt, Unit >::area ( ) const
inline
22 {
23 long double asq = pl::magnsq<Pt, long double>(axis_);
24 return cast<long double>(bottom_) * cast<long double>(right_) / asq;
25 }

References libnest2d::RotatedBox< Pt, Unit >::axis_, libnest2d::RotatedBox< Pt, Unit >::bottom_, and libnest2d::RotatedBox< Pt, Unit >::right_.

◆ axis()

template<class Pt , class Unit = TCompute<Pt>>
const Pt & libnest2d::RotatedBox< Pt, Unit >::axis ( ) const
inline
37{ return axis_; }

References libnest2d::RotatedBox< Pt, Unit >::axis_.

Referenced by Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), and libnest2d::rectarea().

+ Here is the caller graph for this function:

◆ bottom_extent()

template<class Pt , class Unit = TCompute<Pt>>
Unit libnest2d::RotatedBox< Pt, Unit >::bottom_extent ( ) const
inline
35{ return bottom_; }

References libnest2d::RotatedBox< Pt, Unit >::bottom_.

Referenced by Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), and libnest2d::rectarea().

+ Here is the caller graph for this function:

◆ height()

template<class Pt , class Unit = TCompute<Pt>>
long double libnest2d::RotatedBox< Pt, Unit >::height ( ) const
inline
31 {
32 return abs(right_) / std::sqrt(pl::magnsq<Pt, long double>(axis_));
33 }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half abs(const half &a)
Definition Half.h:445

References libnest2d::RotatedBox< Pt, Unit >::axis_, and libnest2d::RotatedBox< Pt, Unit >::right_.

◆ right_extent()

template<class Pt , class Unit = TCompute<Pt>>
Unit libnest2d::RotatedBox< Pt, Unit >::right_extent ( ) const
inline
36{ return right_; }

References libnest2d::RotatedBox< Pt, Unit >::right_.

Referenced by Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), Slic3r::MinAreaBoundigBox::MinAreaBoundigBox(), and libnest2d::rectarea().

+ Here is the caller graph for this function:

◆ width()

template<class Pt , class Unit = TCompute<Pt>>
long double libnest2d::RotatedBox< Pt, Unit >::width ( ) const
inline
27 {
28 return abs(bottom_) / std::sqrt(pl::magnsq<Pt, long double>(axis_));
29 }

References libnest2d::RotatedBox< Pt, Unit >::axis_, and libnest2d::RotatedBox< Pt, Unit >::bottom_.

Member Data Documentation

◆ axis_

◆ bottom_

template<class Pt , class Unit = TCompute<Pt>>
Unit libnest2d::RotatedBox< Pt, Unit >::bottom_ = Unit(0)
private

◆ right_

template<class Pt , class Unit = TCompute<Pt>>
Unit libnest2d::RotatedBox< Pt, Unit >::right_ = Unit(0)
private

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