2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-12-27 14:58:44 +01:00
|
|
|
title: The coordinate system
|
2021-08-25 16:09:31 +02:00
|
|
|
order: 30
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-12-27 14:58:44 +01:00
|
|
|
The coordinate system in FreeSewing -- and in SVG -- follows the same rules as text on a page.
|
|
|
|
You start at the top-left, and as you go to the right, the X-coordinate will increase.
|
|
|
|
As you go down the Y-coordinate will increase.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 00:25:06 +02:00
|
|
|
<Example caption="The coordinate system in an SVG document">
|
|
|
|
```mjs
|
|
|
|
({ Point, points, paths, Path, part }) => {
|
|
|
|
points.origin = new Point(10, 10)
|
|
|
|
points.x = new Point(100, 10)
|
|
|
|
points.y = new Point(10, 50)
|
|
|
|
points.textX = new Point(85, 20).addText('X', 'text-lg')
|
|
|
|
points.textY = new Point(12, 43).addText('Y', 'text-lg')
|
|
|
|
paths.coords = new Path()
|
|
|
|
.move(points.y)
|
|
|
|
.line(points.origin)
|
|
|
|
.line(points.x)
|
|
|
|
.addClass('mark')
|
|
|
|
.attr('marker-start', 'url(#dimensionFrom)')
|
|
|
|
.attr('marker-end', 'url(#dimensionTo)')
|
|
|
|
|
|
|
|
return part
|
|
|
|
}
|
|
|
|
```
|
2022-01-19 11:31:39 +01:00
|
|
|
</Example>
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-12-27 14:58:44 +01:00
|
|
|
The image above illustrates both the X-axis and Y-axis.
|
|
|
|
On the X-axis, `20` is further to the right than `10`.
|
|
|
|
On the Y-axis, `50` is lower than `20`.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
<Note>
|
|
|
|
|
|
|
|
The Y-axis is inverted in many drawing programs, with the origin
|
|
|
|
`(0,0)` being the lower left corner, rather than the upper left corner.
|
|
|
|
|
|
|
|
This is a common point of confusion so keep in mind that the Y-axis may
|
|
|
|
not behave as you would have intuitively expected.
|
|
|
|
|
|
|
|
</Note>
|