1# position 2 3A *position* is a point on the SVG canvas. A *[place](./place.md)* is 4a specific position associated with an object. Every *place* is a *position*, 5but not every *position* is a *place*. This page is about *position*. 6 7 * *expr* **,** *expr* 8 * *place* 9 * *place* **+** *expr* **,** *expr* 10 * *place* **-** *expr* **,** *expr* 11 * *place* **+ (** *expr* **,** *expr* **)** 12 * *place* **- (** *expr* **,** *expr* **)** 13 * **(** *position* **,** *position* **)** 14 * **(** *position* **)** 15 * *fraction* **of the way between** *position* **and** *position* 16 * *fraction* **way between** *position* **and** *position* 17 * *fraction* **between** *position* **and** *position* 18 * *fraction* **<** *position* **,** *position* **>** 19 * *distance* *which-way-from* *position* 20 21## Absolute versus Place-relative Positions 22 23One form of a position is an (X,Y) coordinate pair. This works, but 24its use is discouraged. It is better to use positions that are 25either a *[place](./place.md)* or are derived from one or more places. 26 27## The "**(** *position* **,** *position* **)**" Form 28 29A place of the form "(pos1,pos2)" where pos1 and pos2 are other positions 30means use the X coordinate from pos1 and the Y coordinate from pos2. 31 32~~~ pikchr 33leftmargin = 1cm; 34P1: dot; text "P1" with .s at 2mm above P1 35P2: dot at P1+(2cm,-2cm); text "P2" with .s at 2mm above P2 36dot at (P1,P2); text "(P1,P2)" with .s at 2mm above last dot 37dot at (P2,P1); text "(P2,P1)" with .s at 2mm above last dot 38~~~ 39 40## "*fraction* **of the way between**" Forms 41 42All of these syntactic forms of position are the same: 43 44 * *fraction* **of the way between** *position* **and** *position* 45 * *fraction* **way between** *position* **and** *position* 46 * *fraction* **between** *position* **and** *position* 47 * *fraction* **<** *position* **,** *position* **>** 48 49The last form is the most cryptic, but it is also the most compact 50and hence ends up being the most often used. 51 52In all cases *fraction* is an expression that usually evaluates to between 0.0 53and 1.0. The resulting position is that fraction along a line that 54connects the first *position* to the second *position*. 55 56The *fraction* can be less than 0.0 or greater than 1.0, in which case 57the point is on the extended line that connects the two positions. 58 59~~~ pikchr 60P1: dot; text "P1" with .s at 2mm above P1 61P2: dot at P1+(4cm,1.5cm); text "P2" with .s at 2mm above P2 62line thin color gray dotted from -.5<P1,P2> to 1.5<P1,P2> 63dot at 3/4<P1,P2>; text "3/4<P1,P2>" at (last dot,P1) 64 arrow thin color gray from last text.n to 1mm south of last dot 65dot at -0.25 of the way between P1 and P2 66 text "-0.25 of the way between P1 and P2" at (last dot,P2) 67 arrow thin color gray from last text.s to 1mm north of last dot 68~~~ 69 70## "*position* *which-way-from* *position*" Forms 71 72It is very common to specify a position as an offset from some other 73position using this format. Some examples: 74 75 * 1cm below Obstacle.s 76 * 0.5*linewid left of C0.w 77 * dist(C2,C3) heading 30 from C2 78