Module LineFuncs

Module LineFuncs 

Source
Expand description

Line functions

Functions for working directly with the tg_line type.

There are no direct spatial predicates for tg_line. If you want to perform operations like “intersects” or “covers” then you must upcast the line to a tg_geom, like such:

tg_geom_intersects((struct tg_geom*)line, geom);

Functions§

tg_line_clockwise
Returns true if winding order is clockwise. @param line Input line @return True if clockwise @return False if counter-clockwise
tg_line_clone
Clones a line @param line Input line, caller retains ownership. @return A duplicate of the provided line. @note The caller is responsible for freeing with tg_line_free(). @note This method of cloning uses implicit sharing through an atomic reference counter.
tg_line_copy
Copies a line @param line Input line, caller retains ownership. @return A duplicate of the provided line. @return NULL if out of memory @note The caller is responsible for freeing with tg_line_free(). @note This method performs a deep copy of the entire geometry to new memory.
tg_line_free
Releases the memory associated with a line. @param line Input line
tg_line_index_level_num_rects
Returns the number of rectangles at level. @param line Input line @param levelidx The index of level @return The number of index levels @return Zero if line has no indexing or levelidx is out of bounds. @see tg_line_index_spread() @see tg_line_index_num_levels() @see tg_line_index_level_rect()
tg_line_index_level_rect
Returns a specific level rectangle. @param line Input line @param levelidx The index of level @param rectidx The index of rectangle @return The rectangle @return Empty rectangle if line has no indexing, or levelidx or rectidx is out of bounds. @see tg_line_index_spread() @see tg_line_index_num_levels() @see tg_line_index_level_num_rects()
tg_line_index_num_levels
Returns the number of levels. @param line Input line @return The number of levels @return Zero if line has no indexing @see tg_line_index_spread() @see tg_line_index_level_num_rects() @see tg_line_index_level_rect()
tg_line_index_spread
Returns the indexing spread for a line.
tg_line_length
Calculate the length of a line.
tg_line_line_search
Iterates over all segments in line A that intersect with segments in line B. @note This efficently uses the indexes of each geometry, if available.
tg_line_memsize
Returns the allocation size of the line. @param line Input line @return Size of line in bytes
tg_line_nearest_segment
Iterates over segments from nearest to farthest. @see tg_ring_nearest_segment()`, which shares the same interface, for a detailed description.
tg_line_new
Creates a line from a series of points. @param points Array of points @param npoints Number of points in array @return A newly allocated line @return NULL if out of memory @note A tg_line can be safely upcasted to a tg_geom. (struct tg_geom*)line @note All lines with 32 or more points are automatically indexed.
tg_line_new_ix
Creates a line from a series of points using provided index option. @param points Array of points @param npoints Number of points in array @param ix Indexing option, e.g. TG_NONE, TG_NATURAL, TG_YSTRIPES @return A newly allocated line @return NULL if out of memory @note A tg_line can be safely upcasted to a tg_geom. (struct tg_geom*)poly @see tg_index
tg_line_num_points
Returns the number of points. @param line Input line @return Number of points @see tg_line_point_at()
tg_line_num_segments
Returns the number of segments. @param line Input line @return Number of segments @see tg_line_segment_at() @see LineFuncs
tg_line_point_at
Returns the point at index. @param line Input line @param index Index of point @return The point at index @note This function performs bounds checking. Use tg_line_points() for direct access to the points. @see tg_line_num_points()
tg_line_points
Returns the underlying point array of a line. @param line Input line @return Array or points @see tg_line_num_points() @see LineFuncs
tg_line_rect
Returns the minimum bounding rectangle of a line.
tg_line_segment_at
Returns the segment at index. @param line Input line @param index Index of segment @return The segment at index @see tg_line_num_segments()