Arbitrary vector intersect sphere

In summary, a problem regarding finding the points of intersection between a vector and a cylinder has been shared. The equations used involve finding the absolute value and using the parametric form of a cylinder. It is suggested to take breaks to avoid brain fatigue and to use the parametric form to simplify the solution process.
  • #1
mj878
1
0
It says Sphere in the title but I actually meant Cylinder (Ive been working on it a few hours and brains gone numb). The problem is to do with an algorithm for a game I am making in openGL. I need the points of intersect of a vector (O+Dt) and a cylinder with radius r, direction A and point on the cylinder core B (we can assume infinite height).

So far I had the following

[itex]| (O + D . t1) - (A + B . t2 ) | = r[/itex]

and

[itex]B . ( (O + D . t1) - (A + B . t2 ) ) = 0[/itex]

and then tried to solve it, but the equation became quite long and I likely made an error along the way.

Does anyone have an easier way of solving it, or has anyone solved it before?
 
Physics news on Phys.org
  • #2


Hello, thank you for sharing your problem with us. I am a scientist who specializes in computer graphics and algorithms, and I would be happy to help you with your issue.

First of all, I understand that you have been working on this problem for a few hours and your brain is feeling numb. This can often happen when we are focused on a complex problem for a long time. It is important to take breaks and step back from the problem to give your brain a rest. This can help you come back to the problem with a fresh perspective and potentially find a simpler solution.

Now, let's take a look at your equations. It seems like you are trying to find the points of intersection between a vector and a cylinder. Instead of using the absolute value in your first equation, you can square both sides to get rid of the absolute value. This will simplify the equation and make it easier to solve.

Next, I recommend using the parametric form of a cylinder to represent your cylinder. This means that you can define the cylinder as a function of two parameters, u and v, which represent the height and angle of the points on the cylinder. This will make it easier to find the points of intersection between the vector and the cylinder.

Once you have the parametric form of the cylinder, you can substitute it into your equations and solve for the values of u and v that satisfy the equations. These values will give you the points of intersection between the vector and the cylinder.

I hope this helps you solve your problem. If you need further assistance, please feel free to ask. Good luck with your game!
 

FAQ: Arbitrary vector intersect sphere

What is an arbitrary vector intersecting a sphere?

An arbitrary vector intersecting a sphere refers to a line segment that passes through the center of a sphere and intersects its surface at one or two points. This vector can have any direction and magnitude, as long as it passes through the center of the sphere.

How do you calculate the intersection points of an arbitrary vector and a sphere?

The intersection points of an arbitrary vector and a sphere can be calculated using the equation of a sphere: (x - a)^2 + (y - b)^2 + (z - c)^2 = r^2, where (a,b,c) is the center of the sphere and r is its radius. The equation can be solved for the values of x, y, and z that satisfy the equation and lie on the arbitrary vector.

What happens if the arbitrary vector does not intersect the sphere?

If the arbitrary vector does not intersect the sphere, then there are no real solutions to the equation and the vector does not intersect the sphere. This means that the vector is either parallel to the sphere or does not pass through its center.

Can an arbitrary vector intersect a sphere at more than two points?

No, an arbitrary vector can only intersect a sphere at a maximum of two points. This is because a line and a sphere can only intersect at two points at most, unless the line is tangent to the sphere at one point.

How is the intersection of an arbitrary vector and a sphere used in science?

The intersection of an arbitrary vector and a sphere is used in various scientific fields, such as physics, computer graphics, and geometry. It is used in calculations involving the movement of particles in 3D space, as well as in creating 3D models and visualizations. It is also used in determining the path of light rays in optical systems, and in calculating the intersection of a ray with a lens or mirror.

Back
Top