Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-offset.h File Reference

Go to the source code of this file.

Classes

class  SPOffset
 SPOffset class. More...
 

Functions

double sp_offset_distance_to_original (SPOffset *offset, Geom::Point px)
 Distance to the original path; that function is called from shape-editor-knotholders to set the radius when the control knot moves.
 
void sp_offset_top_point (SPOffset const *offset, Geom::Point *px)
 Computes a point on the offset; used to set a "seed" position for the control knot.
 
SPItemsp_offset_get_source (SPOffset *offset)
 

Function Documentation

◆ sp_offset_distance_to_original()

double sp_offset_distance_to_original ( SPOffset offset,
Geom::Point  px 
)

Distance to the original path; that function is called from shape-editor-knotholders to set the radius when the control knot moves.

The sign of the result is the radius we're going to offset the shape with, so result > 0 ==outset and result < 0 ==inset. thus result<0 means 'px inside source'.

Todo:
Awfully damn stupid method: uncross the source path EACH TIME you need to compute the distance. The good way to do this would be to store the uncrossed source path somewhere, and delete it when the context is finished. Hopefully this part is much faster than actually computing the offset (which happen just after), so the time spent in this function should end up being negligible with respect to the delay of one context.

Definition at line 736 of file sp-offset.cpp.

References Shape::ConvertToShape(), dot(), Shape::dg_arete::dx, Shape::dg_arete::en, fill_oddEven, FIRST, Shape::getEdge(), Shape::getPoint(), Shape::dg_point::incidentEdge, LAST, len, Shape::NextAt(), Shape::numberOfEdges(), Shape::numberOfPoints(), offset, Shape::dg_arete::st, Shape::dg_point::totalDegree(), vectors_are_clockwise(), and Shape::dg_point::x.

◆ sp_offset_get_source()

SPItem * sp_offset_get_source ( SPOffset offset)

◆ sp_offset_top_point()

void sp_offset_top_point ( SPOffset const *  offset,
Geom::Point px 
)

Computes a point on the offset; used to set a "seed" position for the control knot.

Returns
the topmost point on the offset.

Definition at line 896 of file sp-offset.cpp.

References Path::Convert(), Path::Fill(), Shape::getPoint(), Shape::hasPoints(), Path::LoadPathVector(), offset, Shape::SortPoints(), and Shape::dg_point::x.