Extend the ends of a line.
683{
687 uint32_t i;
688 bool forward = false, backward = false;
689
690 if (distance_forward < 0 || distance_backward < 0)
691 lwerror(
"%s: distances must be non-negative", __func__);
692
694 {
695 lwerror(
"%s: line must have at least two points", __func__);
696 }
697
699 if (distance_backward > 0.0)
700 {
701 i = 0;
702
706 {
708 {
709 lwerror(
"%s: line must have at least two distinct points", __func__);
710 }
711 i++;
713 }
715 backward = true;
716 }
717
718 if (distance_forward > 0.0)
719 {
721
725 {
726 if (i == 0)
727 {
728 lwerror(
"%s: line must have at least two distinct points", __func__);
729 }
730 i--;
732 }
734 forward = true;
735 }
736
738
739 if (backward)
740 {
742 }
744 if (forward)
745 {
747 }
749}
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)