I'd look into JSTS for that. I'm probably biased 'cause I used the Java
JTS for many things, and it might be a bit overkill for the one function,
but you're bound to need more geometry calculations later on....
From
https://github.com/bjornharrtell/jsts :
"The JSTS Topology Suite is a JavaScript library of spatial predicates and
functions
for processing geometry conforming to the Simple Features Specification
for SQL published by
the Open Geospatial Consortium. JSTS Topology Suite is also a JavaScript
port of the well
established Java library JTS Topology Suite
<
http://tsusiatsoftware.net/jts/main.html> with
a built in parser for OpenLayers geometries."
BArend
--
Barend Köbben
ITC - University of Twente
PO Box 217, 7500AE Enschede (The Netherlands)
+31-(0)53 4874 253
@barendkobben
>--
>You received this message because you are subscribed to the Google Groups
>"d3-js" group.
>To unsubscribe from this group and stop receiving emails from it, send an
>email to
d3-js+un...@googlegroups.com.
>For more options, visit
https://groups.google.com/groups/opt_out.