Jump to content

Finding center of surface of a cube


Deep Semaphore
 Share

You are about to reply to a thread that has been inactive for 4418 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Well, a cube is simple enough.  I can't pop in world to field test this, but it looks right (unless I got the face numbering wrong)...

vector Face_Ctr(integer face){	vector Size = llGetScale();	float x = 0.5*Size.x;	float y = 0.5*Size.y;	float z = 0.5*Size.z;	list Axis = [<0.0,0.0,z>,<0.0,y,0.0>,<x,0.0,0.0>,<0.0,-y,0.0>,<-x,0.0,0.0>,<0.0,0.0,-z>];	vector Ctr = llGetPos() + llList2Vector(Axis,face)*llGetRot();	return Ctr;}default{	touch_start(integer num)	{		integer Face = llDetectedTouchFace(0);		llSay(0,"The center of face " + (string) Face + " is at "+ (string) Face_Ctr(Face));	}}

 If that works, you ought to be able to do some simple geometry and work out ways to generate the list Axis for any regular solids.  Once you start twisting, skewing, slicing or otherwise torturing them, of course, all bets are off.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4418 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...