Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Intersection between two cones

Subject: Intersection between two cones

From: Doctor61

Date: 6 Feb, 2013 07:32:08

Message: 1 of 7

I have two 3d circles (centre coordiantes and radii) with their normals passing through origin. If you consider the origin to be the vertex of a right cone having the circle as the base, how can I determine if there is an intersection between these cones?

Subject: Intersection between two cones

From: Bruno Luong

Date: 6 Feb, 2013 07:59:09

Message: 2 of 7

"Doctor61" wrote in message <ket0to$214$1@newscl01ah.mathworks.com>...
> I have two 3d circles (centre coordiantes and radii) with their normals passing through origin. If you consider the origin to be the vertex of a right cone having the circle as the base, how can I determine if there is an intersection between these cones?

I believe the intersection is two lines passing through origin. You "just" need to scale appropriately the base circles so that they intersect in 2 points. That will give you two points of the intersection lines.

It should be doable to do the first task using FZERO and writing few equations of circles.
For example the two plane that carries the circles must be intersected as a line.

1) Compute the 2 x two points of the 2 circles falling on this line.

2) Then compute the algebra distances those two pairs of points projected on the line. (chose some arbitrary origin on this line).

3) Varying the distance of on base circle and find the place where the algebra distances in (2) match using fzero.

Bruno

Subject: Intersection between two cones

From: Bill Whiten

Date: 6 Feb, 2013 11:21:08

Message: 3 of 7

"Doctor61" wrote in message <ket0to$214$1@newscl01ah.mathworks.com>...
> I have two 3d circles (centre coordiantes and radii) with their normals passing through origin. If you consider the origin to be the vertex of a right cone having the circle as the base, how can I determine if there is an intersection between these cones?

if centre is x1,y1,z1 and radius r set d^2=x1^2+y1^2+z1^2
Cone is intersection of spheres a^2 (d^2+r^2)=x^2+y^2+z^2 and
a^2 r^2 = (a x1-x)^2+(a y1-y)^2+(a z1-z)^2

Eliminate a to get equation of cone:
x^2+y^2+z^2 = (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4
(check this)

Set x^2+y^2+z^2=1 and solve for points on two cones and this sphere.
E.g. Solve linear equations (1= (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4 etc)
for x and y then substitute into x^2+y^2+z^2=1 to get quadratic for z.

Regards

Subject: Intersection between two cones

From: Doctor61

Date: 7 Feb, 2013 07:47:08

Message: 4 of 7

"Bill Whiten" <W.Whiten@uq.edu.au> wrote in message <keteb4$gmc$1@newscl01ah.mathworks.com>...
> "Doctor61" wrote in message <ket0to$214$1@newscl01ah.mathworks.com>...
> > I have two 3d circles (centre coordiantes and radii) with their normals passing through origin. If you consider the origin to be the vertex of a right cone having the circle as the base, how can I determine if there is an intersection between these cones?
>
> if centre is x1,y1,z1 and radius r set d^2=x1^2+y1^2+z1^2
> Cone is intersection of spheres a^2 (d^2+r^2)=x^2+y^2+z^2 and
> a^2 r^2 = (a x1-x)^2+(a y1-y)^2+(a z1-z)^2
>
> Eliminate a to get equation of cone:
> x^2+y^2+z^2 = (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4
> (check this)
>
> Set x^2+y^2+z^2=1 and solve for points on two cones and this sphere.
> E.g. Solve linear equations (1= (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4 etc)
> for x and y then substitute into x^2+y^2+z^2=1 to get quadratic for z.
>
> Regards

Hi Bruno,

I have actually thought about something like what you described, but I don't know how to implement it in matlab. I thought I can find the two circles at the same distance from origin and see if they have intersections. But I don't know how to do that. Based on what I have found so far, if t is the parameter then any point P on the circle is given by:
P=Rcos(t)u? +Rsin(t)n? ×u? +c
Where u is a unit vector from the centre of the circle to any point on the circumference; R is the radius; n is a unit vector perpendicular to the plane and c is the centre of the circle.

So if I have u1,n1,c1 and u2,n2 and c2, then how can I find the intersection?

Subject: Intersection between two cones

From: Doctor61

Date: 7 Feb, 2013 07:52:14

Message: 5 of 7

"Bill Whiten" <W.Whiten@uq.edu.au> wrote in message <keteb4$gmc$1@newscl01ah.mathworks.com>...
> "Doctor61" wrote in message <ket0to$214$1@newscl01ah.mathworks.com>...
> > I have two 3d circles (centre coordiantes and radii) with their normals passing through origin. If you consider the origin to be the vertex of a right cone having the circle as the base, how can I determine if there is an intersection between these cones?
>
> if centre is x1,y1,z1 and radius r set d^2=x1^2+y1^2+z1^2
> Cone is intersection of spheres a^2 (d^2+r^2)=x^2+y^2+z^2 and
> a^2 r^2 = (a x1-x)^2+(a y1-y)^2+(a z1-z)^2
>
> Eliminate a to get equation of cone:
> x^2+y^2+z^2 = (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4
> (check this)
>
> Set x^2+y^2+z^2=1 and solve for points on two cones and this sphere.
> E.g. Solve linear equations (1= (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4 etc)
> for x and y then substitute into x^2+y^2+z^2=1 to get quadratic for z.
>
> Regards

Thanks Bill, but I do not get your method. You said "Cone is intersection of spheres a^2 (d^2+r^2)=x^2+y^2+z^2 and
> a^2 r^2 = (a x1-x)^2+(a y1-y)^2+(a z1-z)^2". But intersection of two spheres is a circle. Could you please elaborate a little?

Subject: Intersection between two cones

From: Bruno Luong

Date: 7 Feb, 2013 08:17:19

Message: 6 of 7

"Doctor61" wrote in message <kevm5s$fnm$1@newscl01ah.mathworks.com>...

>
> I have actually thought about something like what you described, but I don't know how to implement it in matlab. I thought I can find the two circles at the same distance from origin and see if they have intersections. But I don't know how to do that. Based on what I have found so far, if t is the parameter then any point P on the circle is given by:
> P=Rcos(t)u? +Rsin(t)n? ×u? +c
> Where u is a unit vector from the centre of the circle to any point on the circumference; R is the radius; n is a unit vector perpendicular to the plane and c is the centre of the circle.
>
> So if I have u1,n1,c1 and u2,n2 and c2, then how can I find the intersection?

Let's assume the 2D circle (after projection on a plane) is centered at 0.
Let's work on (x,y) plane. The circle is radius R
You can rotate the coordinates in such way that the line is parallel to y-axis: { x = x0, y arbitrary }.
x0 is the distance of the line to circle center.

The intersection is
x = x0
y = sin(+/-acos(x0/R)) = +- R * sqrt(1 - (x0/R)^2)

If |x0| > |R| there is no intersection.

Just rotate back after finding a solution.

Bruno

Subject: Intersection between two cones

From: Bill Whiten

Date: 7 Feb, 2013 09:36:05

Message: 7 of 7

"Doctor61" wrote in message <kevmfe$gku$1@newscl01ah.mathworks.com>...
> "Bill Whiten" <W.Whiten@uq.edu.au> wrote in message <keteb4$gmc$1@newscl01ah.mathworks.com>...
> > "Doctor61" wrote in message <ket0to$214$1@newscl01ah.mathworks.com>...
> > > I have two 3d circles (centre coordiantes and radii) with their normals passing through origin. If you consider the origin to be the vertex of a right cone having the circle as the base, how can I determine if there is an intersection between these cones?
> >
> > if centre is x1,y1,z1 and radius r set d^2=x1^2+y1^2+z1^2
> > Cone is intersection of spheres a^2 (d^2+r^2)=x^2+y^2+z^2 and
> > a^2 r^2 = (a x1-x)^2+(a y1-y)^2+(a z1-z)^2
> >
> > Eliminate a to get equation of cone:
> > x^2+y^2+z^2 = (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4
> > (check this)
> >
> > Set x^2+y^2+z^2=1 and solve for points on two cones and this sphere.
> > E.g. Solve linear equations (1= (r^2+d^2) (x1 x+y1 y+z1 z)^2/d^4 etc)
> > for x and y then substitute into x^2+y^2+z^2=1 to get quadratic for z.
> >
> > Regards
>
> Thanks Bill, but I do not get your method. You said "Cone is intersection of spheres a^2 (d^2+r^2)=x^2+y^2+z^2 and
> > a^2 r^2 = (a x1-x)^2+(a y1-y)^2+(a z1-z)^2". But intersection of two spheres is a circle. Could you please elaborate a little?

The free parameter a moves the circle thus forming the cone. Eliminating a then gives the equation of the cone.
You can generate a simpler case with circle origin [0,0,a] and diameter a*r, giving z=a and (a r)^2=x^2+y^2 as the circle, eliminate a to get formula of cone.

Regards

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us