MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / calc_intersection

Function calc_intersection

dep/agg/include/agg_math.h:137–156  ·  view source on GitHub ↗

-------------------------------------------------------calc_intersection

Source from the content-addressed store, hash-verified

135
136 //-------------------------------------------------------calc_intersection
137 AGG_INLINE bool calc_intersection(double ax,
138 double ay,
139 double bx,
140 double by,
141 double cx,
142 double cy,
143 double dx,
144 double dy,
145 double* x,
146 double* y)
147 {
148 double num = (ay - cy) * (dx - cx) - (ax - cx) * (dy - cy);
149 double den = (bx - ax) * (dy - cy) - (by - ay) * (dx - cx);
150 if (std::fabs(den) < intersection_epsilon)
151 return false;
152 double r = num / den;
153 *x = ax + r * (bx - ax);
154 *y = ay + r * (by - ay);
155 return true;
156 }
157
158 //-----------------------------------------------------intersection_exists
159 AGG_INLINE bool intersection_exists(double x1,

Callers 3

triangleMethod · 0.85
calc_miterMethod · 0.85
calc_joinMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected