Find if a point is within a triangle: Difference between revisions
Find if a point is within a triangle (view source)
Revision as of 16:18, 11 December 2021
, 2 years ago→{{header|Wren}}: Now uses new core library method.
m (→{{header|Haskell}}: minor details) |
(→{{header|Wren}}: Now uses new core library method.) |
||
Line 1,997:
=={{header|Wren}}==
This is a translation of the ActionScript code for the 'accurate' method in the first referenced article above.
<lang ecmascript>
var EPS_SQUARE = EPS * EPS
Line 2,016 ⟶ 2,013:
var pointInTriangleBoundingBox = Fn.new { |x1, y1, x2, y2, x3, y3, x, y|
var xMin =
var xMax =
var yMin =
var yMax =
return !(x < xMin || xMax < x || y < yMin || yMax < y)
}
|