18#include <glibmm/i18n.h>
22namespace LivePathEffect {
26 extrude_vector(_(
"Direction"), _(
"Defines the direction and magnitude of the extrusion"),
"extrude_vector", &wr, this,
Geom::
Point(-10,10))
45 std::vector<double> cusps;
47 for (
unsigned i = 1 ; i < deriv.
size() ; ++i) {
48 if ( !
are_colinear(deriv[i-1].at1(), deriv[i].at0()) ) {
50 cusps.push_back(deriv.
cuts[i]);
78 if ( !
are_near(pwd2_in.firstValue(), pwd2_in.lastValue()) ) {
79 pwd2_out.
concat( connector + pwd2_in.firstValue() );
80 pwd2_out.
concat( connector + pwd2_in.lastValue() );
84 std::vector<double> cusps;
85 for (
double cusp : cusps) {
86 pwd2_out.
concat( connector + pwd2_in.valueAt(cusp) );
90 for (
double rt : rts) {
91 pwd2_out.
concat( connector + pwd2_in.valueAt(rt) );
107 std::vector<double> cusps =
find_cusps(pwd2_in);
110 bool closed_path =
false;
111 if (
are_near(pwd2_in.firstValue(), pwd2_in.lastValue()) ) {
119 std::vector<double> connector_pts;
121 connector_pts = cusps;
122 }
else if (cusps.empty()) {
126 connector_pts.insert(connector_pts.begin(), cusps.begin(), cusps.end());
127 sort(connector_pts.begin(), connector_pts.end());
130 double portion_t = 0.;
131 for (
unsigned i = 0; i < connector_pts.size() ; ++i) {
133 portion_t = connector_pts[i];
134 if (closed_path && i == 0) {
146 cut.continuousConcat(
portion(pwd2_in, pwd2_in.domain().min(), connector_pts[0] ));
152 }
else if (!
are_near(portion_t, pwd2_in.domain().max())) {
170 using namespace Geom;
Adaptor that creates 2D functions from 1D ones.
constexpr C extent() const
constexpr C middle() const
Range of real numbers that is never empty.
Axis-aligned rectangle that can be empty.
Sequence of contiguous curves, aka spline.
Piecewise< D2< SBasis > > toPwSb() const
void appendNew(Args &&... args)
Append a new curve to the path.
Function defined as discrete pieces.
void continuousConcat(const Piecewise< T > &other)
output_type lastValue() const
std::vector< double > cuts
output_type firstValue() const
void concat(const Piecewise< T > &other)
Two-dimensional point that doubles as a vector.
void registerParameter(Parameter *param)
virtual void resetDefaults(SPItem const *item)
Sets all parameters to their default values and writes them to SVG.
bool concatenate_before_pwd2
LPEExtrude(LivePathEffectObject *lpeobject)
void resetDefaults(SPItem const *item) override
Sets all parameters to their default values and writes them to SVG.
Geom::Piecewise< Geom::D2< Geom::SBasis > > doEffect_pwd2(Geom::Piecewise< Geom::D2< Geom::SBasis > > const &pwd2_in) override
VectorParam extrude_vector
Geom::Point getVector() const
void set_and_write_new_values(Geom::Point const &new_origin, Geom::Point const &new_vector)
Base class for visual SVG elements.
Geom::OptRect geometricBounds(Geom::Affine const &transform=Geom::identity()) const
Get item's geometric bounding box in this item's coordinate system.
LPE effect for extruding paths (making them "3D").
Various utility functions.
Bezier reverse(const Bezier &a)
std::vector< double > roots(SBasis const &s)
Bezier portion(const Bezier &a, double from, double to)
Bezier derivative(Bezier const &a)
Piecewise< SBasis > cross(Piecewise< D2< SBasis > > const &a, Piecewise< D2< SBasis > > const &b)
T dot(D2< T > const &a, D2< T > const &b)
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
D2< T > rot90(D2< T > const &a)
static bool are_colinear(Geom::Point a, Geom::Point b)
static std::vector< double > find_cusps(Geom::Piecewise< Geom::D2< Geom::SBasis > > const &pwd2_in)
Helper class to stream background task notifications as a series of messages.