vg4->misc->points_on_line()
Get point-positions when moving on a line.
SYNTAX
int
vg4->misc->points_on_line(const struct VG_Point *point_start,
const struct VG_Point *point_end,
int stepsize,
struct VG_Point **pointp)
FUNCTION PARAMETERS
| point_start | Starting point-position |
| point_end | Ending point-position |
| stepsize | Desired distance in pixels between the point-positions |
| pointp | For returning allocated array with point-positions, must be freed with free() |
RETURN VALUE
Returns the number of elements in pointp
DESCRIPTION
Get point-positions when moving on a line.
The positions are set from point_start (not included) to point_end (included).
stepsize defines the distance in pixels between the returned point-positions.
EXAMPLE
/* moving from 10,10 to 20,15 with a distance of 2 */ struct VG_Point point_start, point_end, *pointp; int npos, ipos; point_start.x = 10; point_start.y = 10; point_end.x = 20; point_end.y = 15; npos = vg4->misc->points_on_line(&point_start, &point_end, 2, &pointp); for (ipos = 0; ipos < npos; ipos++) { printf("%d,%d\n", pointp[ipos].x, pointp[ipos].y); } if (pointp != NULL) { free(pointp); } /* output: 12,11 14,12 16,13 18,14 20,15 */
SEE ALSO