Circumcicle of a triangle

Blitz3D Forums/Blitz3D Beginners Area/Circumcicle of a triangle

no nickname(Posted 2008) [#1]
Hi everyone!

I wanted to try out the Delaunay-Triangulation. In the first step I have to create a circumcicle, defined by 3 vertices. But my problem starts already here.

I didn't find any useful help in the net how to calculate the coordinates from the circumcicle-center.

Can anyone help me please?

greetings, Christoph (german-speaking. That's why this post may be full of bad english :-) )

PS: I know how to draw the circumcicle on a piece of paper but I'm not able to do this in Blitz. And I'm at the very beginning of vector-calculation :-(


Ross C(Posted 2008) [#2]
I not sure what a circumcicle is :o)


Stevie G(Posted 2008) [#3]
There are delaunay examples in the code archives under 3d Graphics / mesh.


Ross C(Posted 2008) [#4]
Ah, a circumCIRCLE. Can't believe you spelt it wrong 3 times :D

Ok, i've had a look and it appears to me like you find the centre point of each of the triangles sides. Then outwardly project a line from each of these until they collide. Now, creating a perpendicular vector should be easy enough.

For the centre point, i suggest doing a line intersection equation using 2 of the lines. That should give you your centre point :o)


no nickname(Posted 2008) [#5]
Thanks!

I will look for the examples.

In the meantime I found an C-Code and convert it to BB:

Global xc#,yc#,r# ;Kreismittelunktkoordinaten und-Radius

Const EPSILON#=0.000001

Function CircumCircle(xp#,yp#,x1#,y1#,x2#,y2#,x3#,y3#)
Local m1#,m2#,mx1#,mx2#,my1#,my2#
Local dx#,dy#,rsqr#,drsqr#

If (Abs(y1-y2)<EPSILON And Abs(y2-y3)<EPSILON) Then
Return False
ElseIf(Abs(y2-y1)<EPSILON)Then
m2=-(x3-x2)/(y3-y2)
mx2=(x2+x3)/2.0
my2=(y2+y3)/2.0
xc=(x2+x1)/2.0
yc=m2*(xc-mx2)+my2
ElseIf Abs(y3-y2)<EPSILON Then
m1=-(x2-x1)/(y2-y1)
mx1=(x1+x2)/2.0
my1=(y1+y2)/2.0
xc=(x3+x2)/2.0
yc=m1*(xc-mx1)+my1
Else
m1=-(x2-x1)/(y2-y1)
m2=-(x3-x2)/(y3-y2)
mx1=(x1+x2)/2.0
mx2=(x2+x3)/2.0
my1=(y1+y2)/2.0
my2=(y2+y3)/2.0
xc=(m1*mx1-m2*mx2+my2-my1)/(m1-m2)
yc=m1*(xc-mx1)+my1
EndIf
dx=x2-xc
dy=y2-yc
rsqr=dx*dx+dy*dy
r=Sqr(rsqr)
dx=xp-xc
dy=yp-yc
drsqr=dx*dx+dy*dy
Return (drsqr<=rsqr)
End Function

But it's only for 2D.

best wishes, Christoph

PS: Yes, its circumcircle, sorry :-)


Link(Posted 2008) [#6]
i thought the circumference of a triangle is 1/2 B x H...no wait, that's area.
___________________________________________________________