Creating Sphere from Points & missing 3d Bezier Formula

I’ve translated some code inorder to create a sphere from n number of points.

here it is

  
  
void testApp::createSphereFromPoints( const ofxVec3f &center, float radius, int segments )  
{  
	if( segments < 0 )  
		return;  
  
	float *verts = new float[(segments+1)*2*3];  
	for( int j = 0; j < segments / 2; j++ ) {  
		float theta1 = j * 2 * 3.14159f / segments - ( 3.14159f / 2.0f );  
		float theta2 = (j + 1) * 2 * 3.14159f / segments - ( 3.14159f / 2.0f );  
  
		for( int i = 0; i <= segments; i++ ) {  
			ofxVec3f e, p;  
			float theta3 = i * 2 * 3.14159f / segments;  
  
			e.x = cos( theta1 ) * cos( theta3 );  
			e.y = sin( theta1 );  
			e.z = cos( theta1 ) * sin( theta3 );  
			p = e * radius + center;  
  
			verts[i*3*2+0] = p.x;  
			verts[i*3*2+1] = p.y;  
			verts[i*3*2+2] = p.z;  
  
			e.x = cos( theta2 ) * cos( theta3 );  
			e.y = sin( theta2 );  
			e.z = cos( theta2 ) * sin( theta3 );  
			p = e * radius + center;  
  
			verts[i*3*2+3] = p.x;  
			verts[i*3*2+4] = p.y;  
			verts[i*3*2+5] = p.z;  
  
			spherePoints.push_back(p);  
		}  
	}  
}  
  
  

It pushes an number of points to “ofxVec3d spherPoints”. and another function pushes n number of boids into the space with an initial location of a point in over the surface of sphere.

I got that after all:
[attachment=1:5noqy88m]1.jpg[/attachment:5noqy88m]

What I am trying to do is, I want to select randomly 2 points from my sphere, and draw a 3d Bezier line between that two points inorder to get that image:
[attachment=1:5noqy88m]2.jpg[/attachment:5noqy88m]

I have the 2d bezier formula, I am looking for 3d version.

If anyone interested with the code I can upload.

Hi aquila!
that sphere looks pretty cool! mind if u upload the code pls? i’d really love to check it out! thanks so much in advance!!! :shock:

[quote author=“inceptionizta”]Hi aquila!
that sphere looks pretty cool! mind if u upload the code pls? i’d really love to check it out! thanks so much in advance!!! :shock:[/quote]

Ofcourse, here is the code.

src.zip

Tnx a lot! Really saved me a lot of time. I owe you one… :smiley:

did you ever figure out the 3d Bezier Formula?

plz send me the code