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()