2.7 <GskPathPoint>

Structure: <GskPathPoint>

Represents a point on a path.

It can be queried for properties of the path at that point, such as its tangent or its curvature.

To obtain a <GskPathPoint>, use path:get-closest-point!, path:get-start-point!, path:get-end-point! or path-measure:get-point!.

Note that <GskPathPoint> structs are meant to be stack-allocated, and don’t hold a reference to the path object they are obtained from. It is the callers responsibility to keep a reference to the path as long as the <GskPathPoint> is used.

Procedures

Method: path-point:compare self point2 ⇒ %return
Method: compare self point2 ⇒ %return

Returns whether self is before or after point2.

self

Passed: a <GskPathPoint>.

a path point

point2

Passed: a <GskPathPoint>.

another path point

%return

Returned: a 32-bit integer.

-1 if self is before point2, 1 if self is after point2, 0 if they are equal

Method: path-point:copy self ⇒ %return
Method: copy self ⇒ %return

Copies a path point.

self

Passed: a <GskPathPoint>.

a path point

%return

Returned: a <GskPathPoint>.

the copied point

Method: path-point:equal? self point2 ⇒ %return
Method: equal? self point2 ⇒ %return

Returns whether the two path points refer to the same location on all paths.

Note that the start- and endpoint of a closed contour will compare nonequal according to this definition. Use path:is-closed? to find out if the start- and endpoint of a concrete path refer to the same location.

self

Passed: a <GskPathPoint>.

a path point

point2

Passed: a <GskPathPoint>.

another path point

%return

Returned: a boolean.

true if self and point2 are equal

Method: path-point:free self
Method: free self

Frees a path point copied by path-point:copy.

self

Passed: a <GskPathPoint>.

a path point

Method: path-point:get-curvature! self path direction [center] ⇒ %return center
Method: get-curvature! self path direction [center] ⇒ %return center

Calculates the curvature of the path at the point.

Optionally, returns the center of the osculating circle as well. The curvature is the inverse of the radius of the osculating circle.

Lines have a curvature of zero (indicating an osculating circle of infinite radius). In this case, the center is not modified.

Circles with a radius of zero have INFINITY as curvature

Note that certain points on a path may not have a single curvature, such as sharp turns. At such points, there are two curvatures — the (limit of) the curvature of the path going into the point, and the (limit of) the curvature of the path coming out of it. The direction argument lets you choose which one to get.

self

Passed: a <GskPathPoint>.

a path point

path

Passed: a <GskPath>.

the path that self is on

direction

Passed: a <GskPathDirection>, or one of its symbols.

the direction for which to return the curvature

center

Passed, filled in, and returned: a <GraphenePoint>, or #f.

return location for the center of the osculating circle

%return

Returned: a real number.

the curvature of the path at the given point

Method: path-point:get-distance self measure ⇒ %return
Method: get-distance self measure ⇒ %return

Returns the distance from the beginning of the path to the point.

self

Passed: a <GskPathPoint>.

a point on the path

measure

Passed: a <GskPathMeasure>.

a path measure for the path

%return

Returned: a real number.

the distance of self

Method: path-point:get-position! self path position ⇒ position
Method: get-position! self path position ⇒ position

Gets the position of the point.

self

Passed: a <GskPathPoint>.

a path point

path

Passed: a <GskPath>.

the path that self is on

position

Passed, filled in, and returned: a <GraphenePoint>.

Return location for the coordinates of the point

Method: path-point:get-rotation self path direction ⇒ %return
Method: get-rotation self path direction ⇒ %return

Gets the direction of the tangent at a given point.

This is a convenience variant of path-point:get-tangent! that returns the angle between the tangent and the X axis. The angle can e.g. be used in gtk_snapshot_rotate().

self

Passed: a <GskPathPoint>.

a path point

path

Passed: a <GskPath>.

the path that self is on

direction

Passed: a <GskPathDirection>, or one of its symbols.

the direction for which to return the rotation

%return

Returned: a real number.

the angle between the tangent and the X axis, in degrees

Method: path-point:get-tangent! self path direction tangent ⇒ tangent
Method: get-tangent! self path direction tangent ⇒ tangent

Gets the tangent of the path at the point.

Note that certain points on a path may not have a single tangent, such as sharp turns. At such points, there are two tangents — the direction of the path going into the point, and the direction coming out of it. The direction argument lets you choose which one to get.

If the path is just a single point (e.g. a circle with radius zero), then the tangent is set to 0, 0.

If you want to orient something in the direction of the path, path-point:get-rotation may be more convenient to use.

self

Passed: a <GskPathPoint>.

a path point

path

Passed: a <GskPath>.

the path that self is on

direction

Passed: a <GskPathDirection>, or one of its symbols.

the direction for which to return the tangent

tangent

Passed, filled in, and returned: a <GrapheneVec2>.

Return location for the tangent at the point