# 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

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.