23 lines
516 B
Python
23 lines
516 B
Python
import org.apache.commons.math3.geometry.euclidean.threed.Segment as Segment
|
|
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D as Vector3D
|
|
import org.apache.commons.math3.geometry.euclidean.threed.Line as Line
|
|
|
|
|
|
p = Vector3D(0, 0, 3)
|
|
|
|
p1 = Vector3D(0,0,0)
|
|
p2 = Vector3D(0,1,1 )
|
|
tolerance = 0.001
|
|
|
|
l = Line(p1, p2, tolerance)
|
|
|
|
|
|
print l.distance(p)
|
|
print p1.distance(p)
|
|
print p2.distance(p)
|
|
print "---"
|
|
|
|
print l.getAbscissa(p)
|
|
print l.pointAt(l.getAbscissa(p))
|
|
|
|
#print l.closestPoint(Line(p, p, 0.01)) |