Just storing a list of geometry functions that eventually I might up end using for some things involving 2D rendering:
2D (not 3D)
Length of Line (x1, y1, x2, y2) = sqrt ( SQUARED(x2-x1)) + SQUARED(y2-y1) )
Slope of Line (x1, y1, x2, y2) = (y2 - y1) / ( x2 - x1) // Handle div0 situation
Calc interception of 2 lines return x, y intersection
Calc area of triangle accepting any 3 vectors
Calc center of convex polygon with N vertices
Calc area of convex polygon with N vertices (split into series of triangles, area and sum)
2D (not 3D)
Length of Line (x1, y1, x2, y2) = sqrt ( SQUARED(x2-x1)) + SQUARED(y2-y1) )
Slope of Line (x1, y1, x2, y2) = (y2 - y1) / ( x2 - x1) // Handle div0 situation
Calc interception of 2 lines return x, y intersection
Calc area of triangle accepting any 3 vectors
Calc center of convex polygon with N vertices
Calc area of convex polygon with N vertices (split into series of triangles, area and sum)
Comment