I am trying to solve a puzzle with a very large search space, and I think it would be most helpful if I could find points that lie within a certain region of the cube, defined by a cone.

That is, the points that define the cube are:

(0,0,0),

(0,0,1),

(0,1,0),

(0,1,1),

(1,0,0),

(1,0,1),

(1,1,0),

(1,1,1)

Now imagine a cone, with the point always being at (.5,.5,.5), and the base of the cone extends beyond the cube. I would like to be able to vary the base diameter, and then find some random point that exists where the cone and cube intersect.

Perhaps a graphic will help explain what I'm needing:

The orange dot represents the center of the unit cube.

The brownish rod represents a vector defining the center of the cone.

And of course the cone is obvious there.

The blue represents the intersect between the cone and the cube.

So, I want to write a function (pseudo code is fine), where I pass it the cone diameter, and the x,y,z location where the vector intersects the cube, and I'd like to have the function return any random point that is within the intersection.

Make sense? I'll not keep rambling. If you have any questions, please let me know.

Thanks in advance for any help,

Neil

P.S. - First post! Glad to be here!