OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
marchsq::AdaptiveTpmsField Struct Reference
Collaboration diagram for marchsq::AdaptiveTpmsField:

Public Member Functions

 AdaptiveTpmsField (const AdaptiveTpms &tpms, const AdaptiveInfillField &radial_field, const BoundingBox &bbox, coordf_t z, float angle)
float get_scalar (const Coord &p) const
coord_t to_coord (long x) const
long to_coordr (coord_t x) const
Point to_Point (const Coord &p) const

Public Attributes

const coord_t rsize = scaled(rsizef)
const long gsize = std::lround(gsizef / rsizef)
const AdaptiveTpms & tpms
const AdaptiveInfillField & radial_field
RadialScale scale
DensityLevels levels
Point size
Point offs
double z
double cos_angle
double sin_angle

Static Public Attributes

static constexpr float gsizef = 0.40f
static constexpr float rsizef = 0.004f

Detailed Description

Constructor & Destructor Documentation

◆ AdaptiveTpmsField()

marchsq::AdaptiveTpmsField::AdaptiveTpmsField ( const AdaptiveTpms & tpms,
const AdaptiveInfillField & radial_field,
const BoundingBox & bbox,
coordf_t z,
float angle )
inline
654 : tpms(tpms), radial_field(radial_field), scale(tpms, radial_field.axis() < 0 ? 3 : 2)
655 , levels(std::max(tpms.interior_frequency / tpms.surface_frequency, 1e-3), BlendRatio, tpms.gradient)
656 , size(bbox.size()), offs(bbox.min), z(z)
657 , cos_angle(std::cos(angle)), sin_angle(std::sin(angle))
658 {}
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138
RadialScale scale
Definition AdaptiveInfillField.cpp:645
Point size
Definition AdaptiveInfillField.cpp:647
DensityLevels levels
Definition AdaptiveInfillField.cpp:646
const AdaptiveInfillField & radial_field
Definition AdaptiveInfillField.cpp:644
const AdaptiveTpms & tpms
Definition AdaptiveInfillField.cpp:643
Point offs
Definition AdaptiveInfillField.cpp:648
double sin_angle
Definition AdaptiveInfillField.cpp:651
double cos_angle
Definition AdaptiveInfillField.cpp:650
double z
Definition AdaptiveInfillField.cpp:649

References Slic3r::angle(), cos_angle, levels, offs, radial_field, scale, sin_angle, size, tpms, and z.

Here is the call graph for this function:

Member Function Documentation

◆ get_scalar()

float marchsq::AdaptiveTpmsField::get_scalar ( const Coord & p) const
inline
664 {
665 const Point pt = to_Point(p);
666 const double x = unscaled(pt.x());
667 const double y = unscaled(pt.y());
668 const Vec3d obj(cos_angle * x - sin_angle * y, sin_angle * x + cos_angle * y, z);
669 if (radial_field.mode() == AdaptiveInfillMode::SmoothBlend) {
670 // The regular patterns of the two levels around the target of the depth, blended by a smoothstep.
671 auto lattice = [this, x, y](int level) {
672 const double frequency = tpms.surface_frequency * levels.scale(level);
673 return tpms.equation(float(frequency * x), float(frequency * y), float(frequency * z));
674 };
675 if (levels.count == 0)
676 return lattice(0);
677 const double c = std::clamp(levels.level(radial_field.depth(obj)), 0., double(levels.count));
678 const int k = std::min(int(c), levels.count - 1);
679 const double u = c - k;
680 const double w = u * u * (3. - 2. * u);
681 return float((w < 1. ? (1. - w) * lattice(k) : 0.) + (w > 0. ? w * lattice(k + 1) : 0.));
682 }
683 const int axis = radial_field.axis();
685 const size_t count = radial_field.radial(obj, radials);
686 float value = 0.f;
687 for (size_t i = 0; i < count; ++i) {
688 const auto &[center, t, weight] = radials[i];
689 Vec3d q = tpms.surface_frequency * scale(t) * (obj - center);
690 if (axis >= 0)
691 q[axis] = tpms.interior_frequency * obj[axis];
692 value += weight * tpms.equation(float(cos_angle * q.x() + sin_angle * q.y()), float(cos_angle * q.y() - sin_angle * q.x()), float(q.z()));
693 }
694 return value;
695 }
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
std::array< Radial, 2 *MaxMorph > Radials
Definition AdaptiveInfillField.hpp:47
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
void center(ExPolygonsWithIds &e)
Definition Emboss.cpp:1382
constexpr Eigen::Matrix< Tout, 2, EigenArgs... > unscaled(const Slic3r::Point &v) noexcept
Definition Arrange.cpp:81
Point to_Point(const Coord &p) const
Definition AdaptiveInfillField.cpp:699

References Slic3r::center(), cos_angle, count, levels, radial_field, scale, sin_angle, Slic3r::SmoothBlend, to_Point(), tpms, Slic3r::unscaled(), and z.

Referenced by marchsq::_RasterTraits< AdaptiveTpmsField >::get().

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

◆ to_coord()

coord_t marchsq::AdaptiveTpmsField::to_coord ( long x) const
inline
697{ return x * rsize; }
const coord_t rsize
Definition AdaptiveInfillField.cpp:640

References rsize.

Referenced by to_Point().

Here is the caller graph for this function:

◆ to_coordr()

long marchsq::AdaptiveTpmsField::to_coordr ( coord_t x) const
inline
698{ return x / rsize; }

References rsize.

Referenced by marchsq::_RasterTraits< AdaptiveTpmsField >::cols(), and marchsq::_RasterTraits< AdaptiveTpmsField >::rows().

Here is the caller graph for this function:

◆ to_Point()

Point marchsq::AdaptiveTpmsField::to_Point ( const Coord & p) const
inline
699{ return Point(to_coord(p.c) + offs.x(), to_coord(p.r) + offs.y()); }
coord_t to_coord(long x) const
Definition AdaptiveInfillField.cpp:697

References marchsq::Coord::c, offs, marchsq::Coord::r, and to_coord().

Referenced by get_scalar(), and Slic3r::make_adaptive_tpms().

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

Member Data Documentation

◆ cos_angle

double marchsq::AdaptiveTpmsField::cos_angle

Referenced by AdaptiveTpmsField(), and get_scalar().

◆ gsize

const long marchsq::AdaptiveTpmsField::gsize = std::lround(gsizef / rsizef)

◆ gsizef

float marchsq::AdaptiveTpmsField::gsizef = 0.40f
staticconstexpr

◆ levels

DensityLevels marchsq::AdaptiveTpmsField::levels

Referenced by AdaptiveTpmsField(), and get_scalar().

◆ offs

Point marchsq::AdaptiveTpmsField::offs

Referenced by AdaptiveTpmsField(), and to_Point().

◆ radial_field

const AdaptiveInfillField& marchsq::AdaptiveTpmsField::radial_field

Referenced by AdaptiveTpmsField(), and get_scalar().

◆ rsize

const coord_t marchsq::AdaptiveTpmsField::rsize = scaled(rsizef)

Referenced by to_coord(), and to_coordr().

◆ rsizef

float marchsq::AdaptiveTpmsField::rsizef = 0.004f
staticconstexpr

◆ scale

RadialScale marchsq::AdaptiveTpmsField::scale

Referenced by AdaptiveTpmsField(), and get_scalar().

◆ sin_angle

double marchsq::AdaptiveTpmsField::sin_angle

Referenced by AdaptiveTpmsField(), and get_scalar().

◆ size

◆ tpms

const AdaptiveTpms& marchsq::AdaptiveTpmsField::tpms

Referenced by AdaptiveTpmsField(), and get_scalar().

◆ z

double marchsq::AdaptiveTpmsField::z

Referenced by AdaptiveTpmsField(), and get_scalar().


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