views:

145

answers:

3

Hi there. I have created a grid with 40 x 40 vertex3D (small but useful)

I can pick a single vertex out of that grid by simply calling a function with the position array[X][Y], And therefore neighbors too. How can I raise up neighbor vertex Z value so they kinda look like a bubble or sphere kind of thingy?

My first tough was to use:

Neighbor_vertex.Z = sin(PI/4 *  1 - ( 1/ distance_between_Neighbor_and_Pivot) ) * desired_Max_Height

But all I got is something like a wave.... and I would like to have a bubble or Sphere like shape.

THX dudes and dudettes

A: 

Your formula doesn't look quite right. Try this:

Neighbor_vertex.Z = cos (PI / 2 * distance_between_Neighbor_and_Pivot) * desired_Max_Height;

You might want to change the Z value only if the distance is less than 1.0 as well.

Are you using the Grapher app to test your formulae? I recommend it. It ships with the Mac.

lucius
A: 

Thanks man, I'll give it a shot. And no.. I'm new to Mac so I didn't knew it had a Grapher app =D Thanks

Charles Michael
A: 

Um, guys, if you want to make a spherical shape of a buble, you need reverse (arc) function...

So, the formula shall be like Neighbor_vertex.Z = sin( arccos( distance_between_Neighbor_and_Pivot / Buble_Radius ) ) * Buble_Radius.

The image below explains the formula.

Sketch

Anton