OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::Emboss::ProjectTransform Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Emboss.hpp>

Inheritance diagram for Slic3r::Emboss::ProjectTransform:
Collaboration diagram for Slic3r::Emboss::ProjectTransform:

Public Member Functions

 ProjectTransform (std::unique_ptr< IProjection > core, const Transform3d &tr)
std::pair< Vec3d, Vec3d > create_front_back (const Point &p) const override
 convert 2d point to 3d points
Vec3d project (const Vec3d &point) const override
 Move point with respect to projection direction e.g. Orthogonal projection will move with point by direction e.g. Spherical projection need to use center of projection.
std::optional< Vec2d > unproject (const Vec3d &p, double *depth=nullptr) const override
 Back projection.

Private Attributes

std::unique_ptr< IProjection > m_core
Transform3d m_tr
Transform3d m_tr_inv
double z_scale

Detailed Description

Constructor & Destructor Documentation

◆ ProjectTransform()

Slic3r::Emboss::ProjectTransform::ProjectTransform ( std::unique_ptr< IProjection > core,
const Transform3d & tr )
inline
387 : m_core(std::move(core)), m_tr(tr)
388 {
389 m_tr_inv = m_tr.inverse();
390 z_scale = (m_tr.linear() * Vec3d::UnitZ()).norm();
391 }
Transform3d m_tr
Definition Emboss.hpp:383
std::unique_ptr< IProjection > m_core
Definition Emboss.hpp:382
Transform3d m_tr_inv
Definition Emboss.hpp:384
double z_scale
Definition Emboss.hpp:385

References m_core, m_tr, m_tr_inv, and z_scale.

Member Function Documentation

◆ create_front_back()

std::pair< Vec3d, Vec3d > Slic3r::Emboss::ProjectTransform::create_front_back ( const Point & p) const
inlineoverridevirtual

convert 2d point to 3d points

Parameters
p2d coordinate
Returns
first - front spatial point second - back spatial point

Implements Slic3r::Emboss::IProjection.

395 {
396 auto [front, back] = m_core->create_front_back(p);
397 return std::make_pair(m_tr * front, m_tr * back);
398 }

References m_core, and m_tr.

◆ project()

Vec3d Slic3r::Emboss::ProjectTransform::project ( const Vec3d & point) const
inlineoverridevirtual

Move point with respect to projection direction e.g. Orthogonal projection will move with point by direction e.g. Spherical projection need to use center of projection.

Parameters
pointSpatial point coordinate
Returns
Projected spatial point

Implements Slic3r::Emboss::IProject3d.

399 {
400 return m_core->project(point);
401 }

References m_core.

◆ unproject()

std::optional< Vec2d > Slic3r::Emboss::ProjectTransform::unproject ( const Vec3d & p,
double * depth = nullptr ) const
inlineoverridevirtual

Back projection.

Parameters
pPoint to project
depth[optional] Depth of 2d projected point. Be careful number is in 2d scale
Returns
Uprojected point when it is possible

Implements Slic3r::Emboss::IProjection.

402 {
403 auto res = m_core->unproject(m_tr_inv * p, depth);
404 if (depth != nullptr)
405 *depth *= z_scale;
406 return res;
407 }

References m_core, m_tr_inv, and z_scale.

Member Data Documentation

◆ m_core

std::unique_ptr<IProjection> Slic3r::Emboss::ProjectTransform::m_core
private

◆ m_tr

Transform3d Slic3r::Emboss::ProjectTransform::m_tr
private

◆ m_tr_inv

Transform3d Slic3r::Emboss::ProjectTransform::m_tr_inv
private

Referenced by ProjectTransform(), and unproject().

◆ z_scale

double Slic3r::Emboss::ProjectTransform::z_scale
private

Referenced by ProjectTransform(), and unproject().


The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Emboss.hpp