Click here to Skip to main content
15,888,239 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
ormonds18-Oct-08 11:48
ormonds18-Oct-08 11:48 
AnswerRe: How to find 3rd coordinate of a triangle given 2 others Pin
Arash Partow17-Oct-08 18:05
Arash Partow17-Oct-08 18:05 
AnswerRe: How to find 3rd coordinate of a triangle given 2 others Pin
Chesnokov Yuriy17-Oct-08 20:55
professionalChesnokov Yuriy17-Oct-08 20:55 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
Arash Partow18-Oct-08 4:31
Arash Partow18-Oct-08 4:31 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
Member 419459318-Oct-08 7:11
Member 419459318-Oct-08 7:11 
AnswerRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp987618-Oct-08 17:32
cp987618-Oct-08 17:32 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp987618-Oct-08 23:38
cp987618-Oct-08 23:38 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
Arash Partow19-Oct-08 6:32
Arash Partow19-Oct-08 6:32 
I'm not sure what you're on about, but the simplest solution to the problem is to assume a square,
from that you get:

c_1,2 = mid(AB) +/- (perp(A-B) * |AB|/ 2)

code:

template<typename T>
void generate_right_triangle(const wykobi::point2d<T>& a,  const wykobi::point2d<T>& b,
                             wykobi::point2d<T>& c1, wykobi::point2d<T>& c2)
{
   T distance = wykobi::distance(a,b);
   wykobi::point2d<T> mid = wykobi::segment_mid_point(a,b);
   wykobi::vector2d<T> v = wykobi::normalize(wykobi::perpendicular(a - b)) * (distance / T(2.0));
   c1 = mid + v;
   c2 = mid - v;
}


I went for the construction route as most times the non-trivial solutions are more interesting. Smile | :)
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp987619-Oct-08 11:42
cp987619-Oct-08 11:42 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
CPallini19-Oct-08 11:52
mveCPallini19-Oct-08 11:52 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
Arash Partow19-Oct-08 11:56
Arash Partow19-Oct-08 11:56 
AnswerRe: How to find 3rd coordinate of a triangle given 2 others Pin
darrellp28-Nov-08 20:03
darrellp28-Nov-08 20:03 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp987629-Nov-08 14:03
cp987629-Nov-08 14:03 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
darrellp29-Nov-08 14:48
darrellp29-Nov-08 14:48 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp987629-Nov-08 15:20
cp987629-Nov-08 15:20 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
darrellp29-Nov-08 19:58
darrellp29-Nov-08 19:58 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp987629-Nov-08 23:06
cp987629-Nov-08 23:06 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
darrellp30-Nov-08 7:17
darrellp30-Nov-08 7:17 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp98761-Dec-08 15:11
cp98761-Dec-08 15:11 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
darrellp1-Dec-08 17:19
darrellp1-Dec-08 17:19 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
darrellp1-Dec-08 19:27
darrellp1-Dec-08 19:27 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp98762-Dec-08 19:54
cp98762-Dec-08 19:54 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
Member 41945933-Dec-08 3:27
Member 41945933-Dec-08 3:27 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
cp98763-Dec-08 10:19
cp98763-Dec-08 10:19 
GeneralRe: How to find 3rd coordinate of a triangle given 2 others Pin
Member 41945933-Dec-08 10:58
Member 41945933-Dec-08 10:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.