Making a geometry or volume from a wedge of a sphere

Hello! I was wondering if anyone would have a way to make a geometry that would in essence be a wedge of a sphere. It would have some delta theta/phi, map out four corners, and four lines going back to the origin. It would also have some start and end radius.

similar to this picture here
image

I was thinking of possibly using the section of two spheres and connecting them with four lines?

here is something to get you started

2 Likes

Yes, this is a promising direction of thinking.

Instead of four lines, I’d suggest to use four THREE.RingGeometry objects, so that your shape looks like a solid object.

Thank you for the start!!

I should have mentioned I would like the final geometry or volume to be one mesh, if possible?

Is there a straight forward way to accomplish that?

I want to be able to raycast into the final volume

thanks, that’s is a good suggestion! As I posted above, I’d like to take all the points and make one final volume with them if possible

That’s what mergeGeometries does. (BTW, if it is only for raycasting, you do not need a single mesh.)

1 Like

hmm okay. I apologize about my (lack of) knowledge with threejs ray casting.

right now I’m using a cone with

const coneGeom = new ConeGeometry( 2, 2, 4 );
const coneMaterial = new MeshBasicMaterial( {color: color, 0x00FF00} );
const coneVol = new Mesh( coneGeom, coneMaterial );
... raycaster stuff ...
const intersects = raycaster.intersectObjects([coneVol]);

are you saying I can achieve this with this example

Actually, I stand corrected. Only two of the four sides are rings, the other two are not planar. So, my new suggestion is to use a spherical cube – this is a cube which Cartesian coordinates that are interpreted as spherical coordinates that are then converted to Cartesian coordinates. It sounds complex, but it was easy to write.

Here is a demo:

https://codepen.io/boytchev/full/yLGpaox

image

3 Likes

I see it as a deformed cube. Set its vertices with spherical coords :thinking:

Ah! @PavelBoytchev already made a demo with the same idea :slight_smile:

1 Like

I’m sorry!

wow - thank you so much!!

Why so? :slight_smile:
I’m happy, that a solution is already found, when I come to party :smiley: :handshake:

2 Likes

yes, use some csg lib. like three-bvh-csg

ah yiss, this is indeed simpler way out