Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

CTS 10 - Relative coordinates

  • 0 Replies

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 751
    • View Profile
CTS 10 - Relative coordinates
« March 24, 2019, 09:15:30 PM »
When hand-coding large runs of graphical calls, it is easier to think in terms of relative position to the current point, than to add offsets to the current point (to get absolute coordinates). Graphical languages such as SVG offer both absolute and relative coordinates in many places, which is often very convenient.

There are a number of ways this might be done. One would be to offer "relative" versions of path-drawing methods: rarc(), rline(), rellipse(), etc., where all coordinates are relative the the Current Point. The current methods might take an option or optional parameter to declare that coordinates are relative and not absolute. The current methods might accept string coordinates with the number prefixed by R (this would be slower, as string coordinates would each have to be examined, any 'R' removed, converted to a number, and added to the Current Point if it's relative).

A final choice would be to implement a new graphics path method, very similar to SVG's path call. It would be a new language (like SVG's 'd' parameter to path) to do lines, curves, etc., with any mix of absolute and relative coordinates. Something similar might be done to augment text methods, so relative coordinates could be used.