Using Java math classes for Trimesh construction?

The documentation on the Jme math classes is a bit sparse, so i'll ask my question here :slight_smile:



I am programming a class that generates a trimesh that envelopes the spheres. My general path of logic has been to:



1.) find the optimal vertexes on each sphere to connect to the next sphere.

2.) make a beziercurve between each vertex on one sphere to another.

3.) create a vertex and triangle buffer by storing vertexes from the beziercurves.

4.) …triangulate it somehow…

5.)calculate the normals



To find the vertexes i need to connect to get from sphere to sphere, i want to:



1.construct a ray from the center of one circle to the other

2. make a plane orthogonal to the ray

3. somehow calculate the points nearest to the intersection points of the plane and the sphere.



This is all very new to me, i rarely work with the math classes and i'm finding it very confuzzling…



So i suppose my questions are:



a.) is there an easier to generate a mesh that envelopes the spheres…i get the nagging feeling i'm taking the long way for doing this…



b.)if there isn't a better way of doing this…how would i accomplish the ray/plane/sphere algorithm? Because i see no way of doing it since math planes aren't spatials… But then again i have little exposure to these classes.


You might want to take a look at metaballs/isosurfaces, there you have an equation that describes a 3D shape/object and then it is used to construct a scalar field from which a mesh can be constructed.