4.4. Line
Prev | Up | Chapter 4. Constructors | Home | Next

## 4.4. Line #

The input of spherical lines using Euler transformation and length is quite circumstantial (see Section 3.5). For short lines it is easier to input a line specifying the beginning and the end of the line.

`sline(` | begin, |
| end`)`; |

`spoint begin`;
`spoint end`;

If the distance between `begin` and `end` is 180° (`π`), this function returns an error because the location of the line is undefined. However, if longitudes of `begin` and `end` are equal, pgSphere assumes a meridian and returns the corresponding spherical line.

Example 4.4. A line created using begin and end of line

A line starting at `spoint '(270d,10d)'` and ending at `spoint '(270d,30d)'`:

    sql> SELECT set_sphere_output('DEG')
     set_sphere_output
    -------------------
      SET DEG
     (1 row)

    sql> SELECT sline( spoint '(270d,10d)', spoint '(270d,30d)');
              sline
     ----------------------------
      ( 10d, 90d, 270d, ZXZ ), 20d
     (1 row)

Furthermore, there is a function for inputing a line using Euler transformation `trans` and line length `length`

`sline(` | trans, |
| length`)`; |

`strans trans`;
`float8 length`;

where the line length `length` must be given in radians.

Example 4.5. A line created with its transformation and length

The same line as in Example 4.4, but using transformation and line length.

    sql> SELECT sline ( strans '10d, 90d, 270d, ZXZ', 20.0*pi()/180.0 );
              sline
    ------------------------------
     ( 10d, 90d, 270d, ZXZ ), 20d
    (1 row)

Prev | Up | Next
4.3. Circle | Home | 4.5. Ellipse