Board index » delphi » Plane and circle intersection

Plane and circle intersection

Help!

Plane definition: three point
Circle definition: radius and centre

I find the theirs intersection, and draw it.

How can I do this?

 

Re:Plane and circle intersection


Help!

Plane definition: three point
Circle definition: radius and centre

I find the theirs intersection, and draw it.

How can I do this?

Re:Plane and circle intersection


Hi Hollos,

Quote
> Plane definition: three point
> Circle definition: radius and centre

Don't you mean "Sphere definition" rather than "Circle definition"?
Radius and centre alone cannot define a circle in 3D space.

Thrse

Re:Plane and circle intersection


I wish to contact anyone who shares my interest in using Delphi for
scientific/mathematical/engineering programming.  Please reply directly
to
me at
  har...@umich.edu  
--
=====================================================================
Prof. Harley Flanders            
3353 Windemere Court              
Ann Arbor, MI 48105-2867          
734 668 1546                      
har...@umich.edu                  
=====================================================================
Visiting Scholar
University of Michigan
Dept. of Mathematics, East Hall
Ann Arbor, MI 48109
Secretary: 734 764 6485

Home Page:  http://www.unf.edu/~hflander
FTP site:   ftp://osprey.unf.edu
            (log on as anonymous with password your email address;
             change directory to /pub/flanders )

Re:Plane and circle intersection


Quote
Csaba, Hollos <HollosCs...@posta.hu> wrote in message 3b4c5500_2@dnews...
> Help!

> Plane definition: three point
> Circle definition: radius and centre

> I find the theirs intersection, and draw it.

> How can I do this?

The equations are :

plane :

a*x+b*y+c*z+d=0

circle in 3D space = intersection of a plane and a sphere :

x^2+y^2+z^2=R^2
a1*x+b1*y+c1*z+d1=0

you have 3 equations in 3 unknowns (x,y,z) : now you have to solve the
problem mathematically . Unfortunately there is one equation that has
order=2 and this makes things more difficult  .

Re:Plane and circle intersection


Hollos

Thrse is of course right about the circle/sphere thing.

Hi, Thrse: we exchanged e-mail about your admirable implementation
of PointInPolygon  :)

So, Hollos, I assume you want the intersection of sphere and plane and
it's the maths that's troubling you, not the programming .

I don't think I've ever tried this, but here are my musings. Usual
caveats and disclaimers :)

As a preliminary I considered the intersection of line and circle.

As far as sphere and plane is concerned,  you should test firstly
whether the three points (supposed all distinct) do indeed define a
plane (they might all lie on a line). Textbooks such as Mary Boas'
extremely admirable  'Mathematical Methods in the Physical Sciences'
give methods for this sort of thing.

Offhand, I would compute a vector quantity  (which is an analogue of a
well known quantity in complex variable theory ) I shall call the
cross-sum = P0 x P1 + P1 x P2 + P2 x P0 where P0, P1, P2 are the
position vectors of your three points and x is the vector cross
product whose formula you can find in Mary Boas' book (p 104 2nd
edition). The magnitude of this vector is twice the area of the
triangle defined by the three points (?) It follows that if it
computes to zero then your three points are collinear. If this
cross-sum vector is non-zero then it can be shown (I think, I haven't
seen this in a book) that the direction of this vector is that of a
normal (perpendicular) to the plane defined by the three points and
that is useful to know, except I quite forget how I proved that if I
indeed ever did, so it might be wrong :( I rather quickly moved on to
other stuff when I was doing this. The 2D case is straightforward and
well known, not sure about 3D.

(BTW I believe this cross-sum thing generalises somewhat in this
sense: if four points form a quadrilateral in a plane then its
cross-sum is twice its area in a direction normal to the quadrilateral
and so on, but I'm troubled by what this cross-sum quantity represents
when the four points etc. are not coplanar - need to think that out
some time: e-mail / posts most welcome. Petty sure it's right for four
points because of a beautiful (if true) theorem (if a theorem) in
affine geometry which says that the area of a quadrilateral is half
the area of the parallelogram on its diagonals, a theorem (?) whose
provenance I am curious to know if anyone has come across it.)

Any case, working out whether the three points form a plane, and the
direction of the normal to the plane if they do so, is a standard
thing shown in textbooks. If my suggested method is wrong I would
appreciate being corrected.

Actually that's the hard part of all this. You then need to test
whether the plane intersects the sphere to form a circle (or is
possibly tangent to the sphere) and then you need to find the centre
of this circle (or point of contact if it's a tangent plane) and the
radius of the circle. And that is all a pretty straightforward
extension of your musings on line and circle.

Since you've already worked out the normal of the plane, you know the
orientation of the intersecting circle and so the whole thing is
completley determined.

To test intersection, work out the distance from the centre of the
sphere to the plane. Mary Boas shows how to do this at p 109 her book
(this is where knowing the direction of the normal to the plane is
useful).

If this distance is less than the radius of the sphere then the plane
intersects in a circle, equal and it's a tangent plane, but greater
then it doesn't intersect or touch and in that case we take no further
interest in the context of this problem. Let's call this distance d.

The centre of the intersecting circle (or point of tangency) is the
point of the plane nearest the centre of the sphere, i.e. the foot of
the perpendicular from the centre of the sphere to the plane, whose
length (the shortest distance) is what you've just worked out. We
higher mathematicians call that symmetry, other people call it common
sense.

I think the following is right for working out this point (hope I'm
not losing my way here): suppose the position vector of the centre of
the sphere is at R0 and let's write N for the normal vector you found
for the plane (any normal vector will do, my cross-sum would do if
it's right). Then a parametric equation for points on the line from
the radius to the centre of the intersecting circle (or point of
contact) is given by P = R0 + tN where t is a scalar quantity (Mary
Boas p 107) and, in particular (?), the centre of the intersecting
circle, let's call it S, must be given by the formula S = R0 +
dN/mag(N) where the stroke indicates division and mag(N) is the
magnitude of N worked out with the usual formula (Mary Boas p 96).

Finally you need to work out the radius of this intersecting circle,
but that's just Pythagoras. If the radius of the sphere is R, then the
radius of the intersecting circle is sqrt(sqr(R) - sqr(d)) where sqrt
and sqr are the square root and square respectively.

Likely your program wants to test whether a particular point, let's
call it P with coordinates (X, Y, Z),  in 3D space lies on this
circle. You have found the centre S with let's say coordinates (XS,
YS, ZS) and you have found its radius, let's call that r. Then  <two>
equations which together define  the intersecting circle are

sqr(X - XS) + sqr(Y - YS) + sqr(Z - ZS) = sqr(r)  :standard formula
derived from Pythagoras which says the distance of P from S must be r

AND

(P - S) dot N = 0 : dot is the scalar product (Mary Boas p 101 formula
4.10) which is one way of saying P must lie on the plane

and you use these to test any particular point P. If the point
satisfies both equations within the epsilon tolerance of your program
(pace Renate Schaff these newsgroups, who has taken me to task for not
paying more attention to the fact that floating-point arithmetic is
not exact) then you should consider your tested point as being on the
intersection.

Anyway, that would be my first shot at the problem. If it's not
completely right I'm pretty sure bits of it are on the right sort of
track anyway. Hope it helps. Try a numerical example to see if it
gives what looks like a right answer; too lazy myself.

As for drawing the thing, speaking strictly for myself, I would use a
pair of compasses :))

sincerely,

William Boyd

<Boyd.Will...@wanadoo.fr>

Re:Plane and circle intersection


On Sat, 14 Jul 2001 05:07:23 GMT, Boyd.Will...@wanadoo.fr (William

Quote
Reid Boyd) wrote:

.

Quote
>Offhand, I would compute a vector quantity  (which is an analogue of a
>well known quantity in complex variable theory ) I shall call the
>cross-sum = P0 x P1 + P1 x P2 + P2 x P0 where P0, P1, P2 are the
>position vectors of your three points and x is the vector cross
>product whose formula you can find in Mary Boas' book (p 104 2nd
>edition). The magnitude of this vector is twice the area of the
>triangle defined by the three points (?) It follows that if it
>computes to zero then your three points are collinear. If this
>cross-sum vector is non-zero then it can be shown (I think, I haven't
>seen this in a book) that the direction of this vector is that of a
>normal (perpendicular) to the plane defined by the three points and
>that is useful to know, except I quite forget how I proved that if I
>indeed ever did, so it might be wrong :( I rather quickly moved on to
>other stuff when I was doing this. The 2D case is straightforward and
>well known, not sure about 3D.

Just a proof of the above:

Suppose the three points P0, P1, P2 are coplanar. Then, for example,
P0 - P1 and P1 - P2 lie in the plane and are sides of the trinagle.
The vector (P0 - P1) x (P1 - P2) is thus normal to the plane. The
cross product is distributive over vector addition (Mary Boas p 103)
so this vector is thus the same as (P0 - P1) x P1 - (P0 - P1) x P2
which is equivalently P2 x (P0 - P1) - P1 x (P0 - P1) is equivalently
P2 x P0 - P2 x  P1 - P1 x P0 + P1 x P1 is finally P0 x P1 + P1 x P2 +
P2 x P0. That the magnitude of this vector is twice the area of the
triangle follows directly from the definition of the cross product and
I conclude:

  if three points P0, P1, P2 are coplanar then the cross-sum quantity
P0 x P1 + P1 x P2 + P2 x P0 is a vector normal to the plane whose
orientation is right hand screwed when traversing the points in order
PO, P1, P2, and whose magnitude is twice the area of the triangle
formed by P0, P1, P2

which can't be a great discovery but strikes me as very useful and was
not known to me.

The result extends, but the induction is actually rather subtle and
more than I care to type in a post.

My assertion about the area of a quadrilateral is indeed a theorem,
since the cross sum of a quadrilateral can be written (P0 - P2) x (P1
- P3), and indeed I should much like to know ithe provenance of this
theorem: I think it both beautiful and deep.

William Boyd

Boyd.Will...@wanadoo.fr

Re:Plane and circle intersection


Thanks for all.

I come my short vacation.

My problem exectly:
Plane and circle (not sphere) intersection. Parameters for circle: radius,
centre point, and two vectors.

Csaba

Re:Plane and circle intersection


Hi Csaba,

Quote
> My problem exectly:
> Plane and circle (not sphere) intersection. Parameters for circle: radius,
> centre point, and two vectors.

This could be considered as an hyperstatic problem (more constraints than
needed), so the first thing would be to ensure that the center point belongs
to the plane defined by the two vectors (unless both vectors include the
center, of course, in which case there is no problem).

If I understand well, the first step is to find the intersection between the
two planes (a straight line) and then compute the distance between the
center and this line. If this distance (d) is greater than the radius (r),
there can not be any intersection. If it is shorter, you should be able to
find the two points of intersection, as you have triangles with an angle of
90 and two sides whose lengths (d and r) are known.

My experience with 3D geometry is very poor and what I had has fainted in my
memory, so I will leave it to William (Hi William ;)) to check this is
correct and give some hints on how to achieve that...

Thrse

Re:Plane and circle intersection


On Wed, 18 Jul 2001 10:08:47 +0200, "Thrse Hanquet"

Quote
<therese.hanq...@skynet.be> wrote:

.

Quote
>My experience with 3D geometry is very poor and what I had has fainted in my
>memory, so I will leave it to William (Hi William ;)) to check this is
>correct and give some hints on how to achieve that...

Hello Thrse, nice to hear from you.

My post was just a bit of R&R from a hiatus in my current grapplings
with ... which muse, anyone offer a candidate for computing's muse?

Right now I'm more worried about the disconcerting discovery that the
comp.graphics.algorithms FAQ (
ftp://cs.smith.edu/pub/orourke.papers/FAQ.txt.gz), which I've just
discovered, gives a rather more  complex formula for the area of a
polygon in 3D then what I tentatively offered and then claimed to have
proved, and I'll have to sort that out and do some disclaiming etc. -
oh dear, my fault for attempting a proof by descending induction -
prove absolutely anything with that.

So, Hollos and all, please ignore my bletherings for time being (and
probably all of the time) about what I called the cross-sum. (Anyone
out there can throw an enlightening bone or two my direction about
this?)

As for the original problem I will tonight code some stuff up,
hopefully right, and post; least I can do.

sincerely,

William Boyd

Re:Plane and circle intersection


On Wed, 18 Jul 2001 09:03:59 +0200, "Csaba, Hollos"

Quote
<HollosCs...@posta.hu> wrote:
>My problem exectly:
>Plane and circle (not sphere) intersection. Parameters for circle: radius,
>centre point, and two vectors.

Csaba:

As promised some thoughts about your problem. I apologise if I've
wasted you and the group's time with my rather speculative previous
posts this thread.

Like Thrse, I'm still not completely clear about your problem. I
take it to be this: you have two planes, each defined by three points.
In one of these planes you have a circle centred on one of its known
three points with a known radius and you wish to test whether the
circle intersects with the other plane, and if so recover its two (or
one, in case of tangency) points of intersection.

This (in my hands anyway) is a fairly tricky problem in vector
geometry. I haven't got all the way through it to my satisfaction, but
what I'll do is share some thoughts and put the rest of it on my cult
website-with-Nothing-much-in-it over the next few days or so: mojno
code it up as well. That's at http://www.vanyka.co.uk.

I'll follow Thrse's suggested method. I warn you that if you're
newish to vector geometry you probably won't much care for what
follows (and oh dear if you're expert not like me you might well care
for it even less ...). I will use my so-called cross-sum for three
points, which is sound OK (it is my 'generalisation' that must be
wrong - bummer, another immortal contribution to the Queen of Sciences
hits the dust before we can even fire up Geometer's Sketchpad, I was
looking forward to investigating that). As always, the whole thing
might be wrong-headed / plain wrong. Up to you to evaluate its
soundness with some thorough tests.

I'll also walk you through a numerical example as we go, which is of
course how I should have started - I really ought to know better by
now not just to click symbols about on a VDU .

Call your first plane P_plane and your second plane Q_plane. Define
P_plane by three points P0, P1, P2 and Q_plane similarily by three
points Q0, Q1, Q2. In Q_plane there is a circle of radius r centred at
Q0, and we wish to determine its intersection with P_plane. These two
planes in general intersect in a line: if the circle intersects with
P_plane then it intersects with this line.

What follows is a complete solution you should be able to code. There
are two outstanding complications. One is that I don't know of a neat
way to determine a point (any point will do) on the line of
intersection of the planes (short of solving their equations, but
that's <far too mathematical> for us): I work round that quite neatly
imho, but I may very well have missed something simple. The second,
arising from the first, is that there is a problem with a sign
(positive or negative) which has to be faced up to, which I can't see
my way through just yet. I'll clear that up on my website. Worst case
scenario is that you just test in your code which of the two
alternatives make sense. Page references are to Mary Boas' book
'Mathematical Methods In The Physical Sciences'.

The numerical example we'll look at is this. P_plane is defined by the
points P0 = (-1, -1, 1), P1 = (1, -1, -1), P2 = (-1, 1, -1) and
Q_plane by Q0 = (1, 1, 1), Q1 = (-1, 1, 1), Q2 = (1, -1, 1). These
points are (six out of eight) vertices of a cube of side 2 units
centred at the origin and you should take 20 minutes or so out right
now drawing a figure and contemplating it. The three points defining
P_plane form an equilateral triangle, in fact the base of a regular
tetrahedron whose other vertex is (1, 1, 1), while Q_plane is just the
top of the box. I chose this example because a little thought should
convince you that the smallest circle in Q_plane centred Q0 that
intersects (or rather touches for this smallest circle) P_plane is a
circle whose radius is the distance = measure(P0, Q0) = 2sqrt(2), and
indeed touches precisely at P0 = (-1, -1, 1). This is a simple example
chosen precisely to boost our confidence when we see these quantities
turn up in our analysis.

First we calculate the direction of the line of intersection of
P_plane and Q_plane. We do that by calculating a normal vector to each
plane and taking their vector cross product (Mary Boas example 6 p
111). A normal vector is a vector perpendicular to the planes, any
such vector will do, and I will use my blessed cross-sum quantity.
Call these P and Q respectively, where P = P0xP1 + P1xP2 + P2xP0 and Q
= Q0xQ1 + Q1xQ2 + Q2xQ0. We didn't pluck this cross-sum quantity out
of thin air. It's an analogue of a well known quantity in complex
numbers (George Polya's 'work + i flux', we're using the flux bit:
Mary Boas has it at Misc Ex 21 p 144 yet further proof the superior
nature of her book) and we happen to know it and like it because we
enjoy the symmetry of things like it.

We also like gardening, Anna Akhmatova's poetry and especially her
poem 'Voronezh', which we wish we could translate as well as D. M.
Thomas does, and lazing in bed contemplating the Nothing, roughly in
that order;

Calculation (use Mary Boas formula 4.18 p 104) gives:

P = (2i + 2k) + (2i + 2j) + (2j + 2k) = 4i + 4j + 4k
Q = (-2j + 2k) + (2i + 2j) + (-2i + 2k) = 4k.

Often at this stage, because one is only interested in the direction,
one 'normalises' the vectors, to get a vector of length just one: the
trick is to divide by the magnitude. In this case we would reach:

P_hat = (1/sqrt(3))(i + j + k)
Q_hat = k

however prolly we shan't use these: you can if you like.

Form the cross product now to get the direction of the line of
intersection. We can form the cross product either as PxQ or QxP. It
doesn't matter right now which you use, it just changes the sense of
the direction of the line 'forwards or backwards'. But it will matter
later on when we come to contemplate a sign, that sign bit I mentioned
which I'm challenged to work out right now. We'll work out PxQ and
call it el (for line). We get:

el = PxQ = (4i + 4j + 4k)x(4k) = 16i - 16j

and in this case we will work out this vector normalised to get the
unit direction vector el_hat of the line:

el_hat = (1/sqrt(2))(i - j).

Now, following Thrse, we need to work out the shortest distance from
Q0, the centre of our circle, to this line el. This is well-known
thing to do, a bit of voodoo magic in it, and if you're student new to
vector geometry definitely something to home in on in your studies: no
way will you think it up by yourself in an exam, well if you're
'normal' (hee *joke*) anyway. We always have to look it up ourselves
*comforting* (to us we mean: convincing proof we're regular, see).

Problem is you need a point on the line and as mentioned before this
is too mathematical and hard for us.

So we do this: work out the distance from Q0 to the P_plane instead
(not the same thing), work out the angle between the planes, and use
trig.

Mary Boas does distance from point to plane p 110, another bit of vm:
call this distance h and in our case the formula is:

h = abs( (any_P - Q0) dot P_hat)

where abs indicates we take the plus sign because we talking distances
here, dot is the scalar product, P_hat is what we said we wouldn't
prolly use, and any_P means we can select any point we like in P_plane
(the vm bit afore mentioned, the formula works out the same): we have
three points at our disposal and we'll use P0:

h = abs([(-1, -1, 1) - (1, 1, 1)] dot  (1/sqrt(3))(i + j + k))
  = abs((1/sqrt(3))(-2i - 2j) dot (i + j + k))
  = abs((1/sqrt(3))(-2 - 2))
  = 4/sqrt(3)

Mary Boas does angle between planes example 6 p 111, where she asks
for the cos of the angle: we need the sin of the angle, so we'll use
the vector product. In this case our formula is:

sin(angle) = magnitude(PxQ)/(magnitude(P)magnitude(Q))
           = 16sqrt(2)/(4sqrt(3)4)
           = sqrt(2)/sqrt(3)

where magnitude is Mary Boas formula 4.1 p 96.

Now sketch a diagram. The point of the line el closest to Q0 we'll
call D0, the point of the plane P_plane closest to Q0 we'll call H0,
and we're looking at the triangle Q0-H0-D0 which is right-angled at H0
and whose angle at D0 is the 'angle' between the planes, where the
quotes indicate a small subtlety we can safely pass over. We need the
quantity d = measure(Q0, D0) and we can calculate this using
trigonometry as d = h/sin(angle). We get:

d = (4/sqrt(3))/(sqrt(2)/sqrt(3))
  = 2sqrt(2)

as promised right at the beginning of all this.

Well, we've got the smallest sized circle that contacts the P_plane,
but we still have lots to do if we want to calculate the intersection
of larger circles. We must get at the equation of the line el to do
that. We have its direction el-hat, but we still need a point on the
line to fix it in space and write down an equation for it.

But we can work out the point D0 now because we've just computed d and
we can calculate a normalised hat vector for the vector D0 - Q0
representing the directed quantity Q0 to D0. This is because this
vector is at right angles to both el(shortest distance property) and Q
(it lies in Q_plane and Q is normal to Q_plane). It follows that
either the vector product Qxel or elxQ has the direction and sense of
this vector D0 - Q0, and this is where I'm presently challenged by the
sign: I'm not quite sure how to determine which, but you can work
round it in your code with a test, and I expect I'll see my way
through it tonight and put it on my web-site. (Experts not like us
will note that we are introducing a vector triple product at this
stage Mary Boas p 239 <too hard for likes of us> that puts (?) D0 - Q0
in the space spanned by P and Q which I really can't fathom or
visualise right now, and perhaps where we can get a real insight into
how best to do this problem?)

It turns out we should choose elxQ and we get:

(D0 - Q0)_hat = elxQ/magnitude(elxQ)
              = -(1/sqrt(2))(i + j)

The vector DO is Q0 + d(D0 - Q0)_hat (i.e. the journey to Q0 plus d
times the unit vector in the direction Q0 to D0):
...

read more »

Re:Plane and circle intersection


Hi William,

Just in case you would not know it, this site (already mentioned by Asbj?rn
in another thread) seems to contain a lot of interesting algorithms, notably
for the intersection of two planes:

http://astronomy.swin.edu.au/pbourke/geometry/

By the way, I found there a drawing reflecting exactly what I had in mind
when I wrote the PointInPolygon algorithm...

Thrse

Re:Plane and circle intersection


On Thu, 19 Jul 2001 09:15:21 +0200, "Thrse Hanquet"

Quote
<therese.hanq...@skynet.be> wrote:

Hi Thrse,

Quote
>Just in case you would not know it, this site (already mentioned by Asbj?rn
>in another thread) seems to contain a lot of interesting algorithms, notably
>for the intersection of two planes:

>http://astronomy.swin.edu.au/pbourke/geometry/

Yes indeed: I found it a while back. There are beautiful graphics on
it and a good selection of algorithms, including a lot of advice and
coding (C) for 3D algorithms, which I plan to have a go at some time.

I had forgotten his pages on line with line etc. My impression at the
time was that they weren't terribly interesting to me as he doesn't
really note vector methods. He uses the notation, but doesn't carry it
through.I think there are better methods for shorterst distance
between line and line and plane and plane than he notes. I did look at
his page on plane with plane, however, and I noticed how he obtains a
point on the intersection of the two planes as a linear combination of
the normals to the plane, which occurred to me during the course of my
working Csaba's problem, and which actually should be interesting to
do in general for two planes, defined by three points each,using the
expressions I give for their normals, and I'll do that over the
weekend. Better not post it, unless it's really interesting ;-) , if
you're curious you'll probably have to look for it on my website. I
notice Tamarack Associates appear to have stopped archiving my posts
.. paranoia...

I also found a link to a nice Win program generating cut-out nets of
polyhedra as well, this visit.

I've posted into comp.grahics.algorithms concerning my embarrassment
with my cross-sum quantity. Can't understand what's going on.  I must
be labouring under a really serious misapprehension somewhere.

sincerely,

William

Re:Plane and circle intersection


.

Quote
>I've posted into comp.grahics.algorithms concerning my embarrassment
>with my cross-sum quantity. Can't understand what's going on.  I must
>be labouring under a really serious misapprehension somewhere.

* me to me *

Hi William,

ooph ... they {*word*190} in you there.

Happily it turns out I'm not wrong, just stupid.

William
http://www.vanyka.co.uk

Re:Plane and circle intersection


You must manage so that the 2 vectors defining your circle, are in fact
orthogonal (i.e. perpendicular) radii of your circle. In that case, you can
express the equation of the circle with parametric space coords, and your
problem is becoming "easier".
Let us set that the center of your circle is point C (xc, yc, zc) and you know
2 points, P and Q, on your circle located on 2 orthogonal radii. These points
are defined by vector CP  (vpx, vpy, vpz) and CQ  (vqx, vqy, vqz).
First, the above definitions imply that (R being the radius of your circle) :
vpx^2 + vpy^2 + vpz^2  =  vqx^2 + vqy^2 + vqz^2  =  R^2
vpx*vqx  +  vpy*vqy  + vpz*vqz  =  0     (dot product of  2 orthogonal
vectors)
Any point M (xm, ym, zm) on the circle may be defined by the Chasles
relationship :
vector OM  =  vector OC  +  vector CM
If  teta is the angle between vector CP and vector CM :
vector OM  =  vector OC  +  cos(teta)*vector CP  +  sin(teta)*vector CQ
Which makes :
xm = xc  +  cos(teta)*vpx  +  sin(teta)*vqx
ym = yc  +  cos(teta)*vpy  +  sin(teta)*vqy
zm = zc  +  cos(teta)*vpz  +  sin(teta)*vqz
These are the parametric space coords of your circle.

Now, you want to compute the intersection of this circle with a plane of
general equation :
A*x  +  B*y  +  C*z  +  D  =  0
Let's set the values of the 3 quantities :
C1  =  A*xc    +  B*yc    +  C*zc     +  D
C2  =  A*vpx  +  B*vpy  +  C*vpz
C3  =  A*vqx  +  B*vqy  +  C*vqz
We substitute x, y and z in the plane equation by the values of xm,ym and zm
and we get :
C1  +  cos(teta)*C2  +  sin(teta)*C3  =  0
There's a little trick here. We must define angle phi such as :    phi =
ArcTan(C3 / C2)  , or  C3/C2 = Tan(phi) = sin(phi)/cos(phi)
Then :
cos(teta)*C2  +  sin(teta)*C3 = C2*(cos(teta)  +  sin(teta)*C3/C2)
=  C2*(cos(teta)  +  sin(phi)*sin(teta) / cos(phi))
=  (C2 / cos(phi)) * (cos(teta)*cos(phi) + sin(teta)*sin(phi))
= (C2 / cos(phi))  * cos(teta - phi)
Therefore, the solutions comply with the equation :
C1  +  (C2 / cos(phi))*cos(teta - phi)  =  0
Or :
teta   =  phi  +  ArcCos( C1*cos(phi) / C2)
You will get 2 values, because cos(angle) = cos( - angle), and this is
perfectly normal as your intersection between your circle and your plane is
composed of 2 points.
This demonstration may seem difficult, but if you define your circle as the
intersection of a plane and a sphere, which is the most frequent way for
defining a circle in 3D, then the equations are becoming extremely difficult
as you have to "manipulate" 2 planes and a sphere, which anyway will lead you
to a second degree equation.
Hope that can help.

        Eric  Pilleux

Quote
"Csaba, Hollos" wrote:
> Thanks for all.

> I come my short vacation.

> My problem exectly:
> Plane and circle (not sphere) intersection. Parameters for circle: radius,
> centre point, and two vectors.

> Csaba

Other Threads