0

I need to calculate the distance from a point [x y z] to the surface of an object (at this stage a simple rectoid, but later an arbitrary shape) along [0 0 1].

I could do this defining the surfaces as planes using unit vectors and then doing a linear algebra calculation to find the distance to all the planes along [0 0 1] but as someone fairly new to coding and Java, I wanted to see if there was a library or a more efficient way of doing this as in the long term I may have complex convex objects, so need to be careful to use standard practices (so I can use something else to generate the planes!)

Thanks,

1 Answers1

0

If you are using Point3D to represent your points then you have a distance method you can use to calculate the distance. So the question is which point on the surface do you want? If you just need any point on the surface you could just pick one of the corner points and use that to calculate the distance.

Emil L
  • 20,219
  • 3
  • 44
  • 65
  • Thanks for your input. I need the point on the surface along the [0 0 1] direction from the [x y z] point. ie the intersection of the line-vector (x,y,z) + k(0,0,1) with the surface. This is a simple linear algebra calculation if i represent the surface a set of planes. What the best surface representation to use is (Wikipedia hints a face-vertex mesh might be a good idea?). In the future I will need to generate large surface meshes from varied data inputs, so need to start with something that is fairly standard. – Helicase Apr 13 '12 at 18:14