Logo_iSurf_org

Subscribe
to eAlerts

for Geom Site
Updates

CLICK HERE

 

C++ Code TOC

by Dan Sunday

 

 

This page is a catch-all Code TOC, for all algorithm (C++) implementations scattered throughout the GeomAlgoritms.com site. Plus, there are also classes not provided elsewhere, like the Point and Vector classes. And, there are some discussions about why certain design decisions were made. Although we have tried to be flexible in our decisions, if you have other preferences, feel free to modify our classes to match your application situation, as long as you provide API’s that can be used by the algorithm implementations. In any case, we hope the code we provide is useful for you.

We have organized the code into the following three categories:
 


Core Classes

  • Point & Vector Classes
    • Design Decisions
    • Point Class API
    • Vector Class API
  • Line, Ray, and Segment Classes
  • Polyline and Polygon Classes
    • Triangle and Rectangle Classes
  • Plane Class
  • Polyhedron Class
  • SweepLine Data Structures


Primitive Functions

isLeft()

- test if a point is Left|On|Right of an infinite 2D line

orientation2D_Triangle()

- test the orientation of a 2D triangle

area2D_Triangle()

- compute the area of a 2D triangle

orientation2D_Polygon()

- test the orientation of a simple 2D polygon

area2D_Polygon()

- compute the area of a 2D polygon

area3D_Polygon()

- compute the area of a 3D planar polygon

closest2D_Point_to_Line()

- find the closest point to a line (in 2D)

dist_Point_to_Line()

- get the distance of a point to a line (any D)

dist_Point_to_Segment()

- get the distance of a point to a segment (any D)

cn_PnPoly()

- crossing number test for a point in a 2D polygon

wn_PnPoly()

- winding number test for a point in a 2D polygon

dist_Point_to_Plane()

- get distance (and perp base) from a point to a 3D plane

intersect2D_2Segments()

- find the intersection of 2 finite 2D segments

inSegment()

- determine if a point is inside a segment (any D)

intersect3D_SegmentPlane()

- find the 3D intersection of a segment and a plane

intersect3D_2Planes()

- find the 3D intersection of two planes

intersect3D_RayTriangle()

- find the 3D intersection of a ray with a triangle

dist3D_Line_to_Line()

- get the 3D minimum distance between 2 lines

dist3D_Segment_to_Segment()

- get the 3D minimum distance between 2 segments

cpa_time()

- compute the time of CPA for two tracks (in 3D)

cpa_distance()

- compute the distance at CPA for two tracks (in 3D)



Application Level Routines

fastBall()

- get a fast approximation for the 2D bounding ball

simple_Polygon()

- test if a 2D Polygon is simple or not

chainHull_2D()

- Andrew's monotone chain 2D convex hull algorithm

nearHull_2D()

- the BFP fast approximate 2D convex hull algorithm

simpleHull_2D()

- Melkman's 2D simple polyline O(n) convex hull algorithm

intersect2D_SegPoly()

- intersect a 2D segment with a convex polygon

polyMax_2D()

- find a 2D polygon's max vertex in a specified direction

dist2D_Poly_to_Line()

- find the distance from a 2D polygon to a line

tangent_PointPoly()

- find a 2D polygon's exterior tangents (brute force)

tangent_PointPolyC()

- fast binary search for tangents to a convex polygon

RLtangent_PolyPolyC()

- get the RL tangent between two convex polygons

poly_decimate()

- remove vertices to get a smaller approximate polygon

 

© Copyright 2012 Dan Sunday, 2001 softSurfer