Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::Emboss::ProjectScale Class Reference

#include <src/libslic3r/Emboss.hpp>

+ Inheritance diagram for Slic3r::Emboss::ProjectScale:
+ Collaboration diagram for Slic3r::Emboss::ProjectScale:

Public Member Functions

 ProjectScale (std::unique_ptr< IProjection > core, double scale)
 
std::pair< Vec3d, Vec3dcreate_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< Vec2dunproject (const Vec3d &p, double *depth=nullptr) const override
 Back projection.
 

Private Attributes

std::unique_ptr< IProjectioncore
 
double m_scale
 

Detailed Description

Constructor & Destructor Documentation

◆ ProjectScale()

Slic3r::Emboss::ProjectScale::ProjectScale ( std::unique_ptr< IProjection core,
double  scale 
)
inline
321 : core(std::move(core)), m_scale(scale)
322 {}
int scale(const int val)
Definition WipeTowerDialog.cpp:14
double m_scale
Definition Emboss.hpp:318
std::unique_ptr< IProjection > core
Definition Emboss.hpp:317

Member Function Documentation

◆ create_front_back()

std::pair< Vec3d, Vec3d > Slic3r::Emboss::ProjectScale::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.

326 {
327 auto res = core->create_front_back(p);
328 return std::make_pair(res.first * m_scale, res.second * m_scale);
329 }

References core, and m_scale.

◆ project()

Vec3d Slic3r::Emboss::ProjectScale::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.

330 {
331 return core->project(point);
332 }

References core.

◆ unproject()

std::optional< Vec2d > Slic3r::Emboss::ProjectScale::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.

333 {
334 auto res = core->unproject(p / m_scale, depth);
335 if (depth != nullptr) *depth *= m_scale;
336 return res;
337 }

References core, and m_scale.

Member Data Documentation

◆ core

std::unique_ptr<IProjection> Slic3r::Emboss::ProjectScale::core
private

◆ m_scale

double Slic3r::Emboss::ProjectScale::m_scale
private

Referenced by create_front_back(), and unproject().


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