Extend the ends of a line.
673{
677 uint32_t i;
678 bool forward = false, backward = false;
679
680 if (distance_forward < 0 || distance_backward < 0)
681 lwerror(
"%s: distances must be non-negative", __func__);
682
684 {
685 lwerror(
"%s: line must have at least two points", __func__);
686 }
687
689 if (distance_backward > 0.0)
690 {
691 i = 0;
692
696 {
698 {
699 lwerror(
"%s: line must have at least two distinct points", __func__);
700 }
701 i++;
703 }
705 backward = true;
706 }
707
708 if (distance_forward > 0.0)
709 {
711
715 {
716 if (i == 0)
717 {
718 lwerror(
"%s: line must have at least two distinct points", __func__);
719 }
720 i--;
722 }
724 forward = true;
725 }
726
728
729 if (backward)
730 {
732 }
734 if (forward)
735 {
737 }
739}
int ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance)
Append a POINTARRAY, pa2 to the end of an existing POINTARRAY, pa1.
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
int p4d_same(const POINT4D *p1, const POINT4D *p2)
int lwline_is_empty(const LWLINE *line)
int ptarray_has_z(const POINTARRAY *pa)
int project_pt_pt(const POINT4D *A, const POINT4D *B, double distance, POINT4D *R)
Azimuth is angle in radians from vertical axis.
int ptarray_has_m(const POINTARRAY *pa)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
uint32_t lwline_count_vertices(const LWLINE *line)
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)