Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Circumcenter of a triangle

Author
Message
Proteus 1935
22
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Brazil
Posted: 27th Oct 2003 02:33
Hi there folks

This shouldn't be THAT complicated but I couldn't find it out... I need to find the circumcenter of a triangle in 3d space given the triangle vertexes... But so far I couldn't even find the circumcenter of a triangle in a 2d plane
any suggestions?

Currently coding: 3d-2d latitude/longitude
Recent coding: elliptical orbits
Proteus
QuothTheRaven
23
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 27th Oct 2003 02:47
same as any polygon, the midpoint of the height and the width

Proteus 1935
22
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Brazil
Posted: 29th Oct 2003 17:43
No, it doesn't work (or I didn't understand what you meant) but I've found a way to find it out , if I finish the code for it i'll post

Currently coding: 3d-2d latitude/longitude
Recent coding: elliptical orbits
Proteus
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 29th Oct 2003 21:40
The average of all thress corners?



Brains are for idiots.

Athelon XP 1600 Plus - Nvidia Geforce MX400 - 256mb RAM
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Oct 2003 00:52
That's so simple ... it just can't be true ...
Proteus 1935
22
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Brazil
Posted: 31st Oct 2003 18:05
I've tried that before, But Again too easy to be true...
Yesterday I've found a way to get the circumcenter (took me an hour to simplify it) but I can't install DBP in this pc so I can't test it, as soon as I get my pc back I'll post the DBP code

Currently coding: 3d-2d latitude/longitude
Recent coding: elliptical orbits
Proteus
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 31st Oct 2003 18:29
Its too easy because its wrong (I added a circle to show proof)



System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 31st Oct 2003 19:26
Sure is (hence the question mark after my solution).

Do you bite your thumb at me sir?

Athelon XP 1600 Plus - Nvidia Geforce MX400 - 256mb RAM
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 31st Oct 2003 19:30
Ah, I see. You want the point where the centre of a circle would be if the triangles points all touched the circumference of that circle.

I've never heard of this name before ...

Wouldn't you just extend a ray at 90 degrees to the midpoint of two lines of the triangle and check where they intersect? If so, you can use the 2D line intersection code I've posted in CodeBase to do some of this for you.
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 31st Oct 2003 19:37 Edited at: 31st Oct 2003 19:38
I did it here you go




now I have a head ache

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 31st Oct 2003 20:00
A cleaned up version



System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Proteus 1935
22
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Brazil
Posted: 31st Oct 2003 21:35
Wow! you're fast!
How did you do it, Distance to the 3 points or perpendicular to side mid-point line intersection?

Currently coding: 3d-2d latitude/longitude
Recent coding: elliptical orbits
Proteus
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 31st Oct 2003 22:29
Dammed if I know! I found the following on the internet and hacked it into Basic


Quote: "
It so happens I just prepared an answer to the posed question as
part of a textbook exercise.

Let a, b, and c be the three given points.
Use _0 and _1 as x and y coordinates.
The coordinates of the center p=(p_0,p_1) of the circle through them is:


p_0 =
( b_1 a_0^2
- c_1 a_0^2
- b_1^2 a_1
+ c_1^2 a_1
+ b_0^2 c_1
+ a_1^2 b_1
+ c_0^2 a_1
- c_1^2 b_1
- c_0^2 b_1
- b_0^2 a_1
+ b_1^2 c_1
- a_1^2 c_1 )
/ D

p_1 =
( a_0^2 c_0
+ a_1^2 c_0
+ b_0^2 a_0
- b_0^2 c_0
+ b_1^2 a_0
- b_1^2 c_0
- a_0^2 b_0
- a_1^2 b_0
- c_0^2 a_0
+ c_0^2 b_0
- c_1^2 a_0
+ c_1^2 b_0)
/ D

where

D = 2( a_1 c_0 + b_1 a_0 - b_1 c_0 -a_1 b_0 -c_1 a_0 + c_1 b_0 ).

The radius of the circle is then:

r^2 = (a_0 - p_0)^2 + (a_1 - p_1)^2

Degeneracies occur when D=0.
"


System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Toothpick
23
Years of Service
User Offline
Joined: 9th Feb 2003
Location:
Posted: 1st Nov 2003 01:17
so why would you want to know the circumcenter?


You wouldn't get many of them for a clock cycle, my cpu
is quaking at the sight of all the ^ and * !
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 1st Nov 2003 01:25
Clever .

Do you bite your thumb at me sir?

Athelon XP 1600 Plus - Nvidia Geforce MX400 - 256mb RAM
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Nov 2003 02:43
Homework question?
Proteus 1935
22
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Brazil
Posted: 1st Nov 2003 17:29
No, it wasn't a homework question (In fact I just finished High-school yesterday ) I was trying to rotate the faces of a model with their circumcenter as origins but as Toothpick said I wouldn't get many of them for a clock cycle ,anyway it's a nice piece of code I'm sure there is some use to it

Currently coding: 3d-2d latitude/longitude
Recent coding: elliptical orbits
Proteus

Login to post a reply

Server time is: 2026-07-26 13:02:12
Your offset time is: 2026-07-26 13:02:12