D
David E.
Here's somewhat of an interesting problem. I am creating a class called
Rectangle. It takes in 4 sets of Cartesian coordinates (i.e. (x,y)
coordinates.). I'm assuming that the rectangle can be rotated too when
receiving these coordinates.
How would I go about setting methods to
A>"order" them (so that when i trace the outsides, point A,B,C,D all are
continous, as opposed to crossing in the "middle"...
B> testing that they are equal sides BUT(this has been where i get stuck)
all 90 degree angles...
Just so you know that i've been thinking abou this rather than throwing it
at you, here have been my approaches..
Assuming points A, B, C, D
First i figured
if ((side AB==side DC) &&(side BC==side AD))
then it is a quadrilateral with 2 pairs of equal sides.. But a parallelogram
also fits this bill.
I figure this might get complicated. There were numerous things i thought
of. I guess my goal is to KISS, but I have a feeling it won't be that
simple... Any ideas?
This isnt for school.. just for my own.... ?entertainment?... heheheh
Thanks,
Dave
Rectangle. It takes in 4 sets of Cartesian coordinates (i.e. (x,y)
coordinates.). I'm assuming that the rectangle can be rotated too when
receiving these coordinates.
How would I go about setting methods to
A>"order" them (so that when i trace the outsides, point A,B,C,D all are
continous, as opposed to crossing in the "middle"...
B> testing that they are equal sides BUT(this has been where i get stuck)
all 90 degree angles...
Just so you know that i've been thinking abou this rather than throwing it
at you, here have been my approaches..
Assuming points A, B, C, D
First i figured
if ((side AB==side DC) &&(side BC==side AD))
then it is a quadrilateral with 2 pairs of equal sides.. But a parallelogram
also fits this bill.
I figure this might get complicated. There were numerous things i thought
of. I guess my goal is to KISS, but I have a feeling it won't be that
simple... Any ideas?
This isnt for school.. just for my own.... ?entertainment?... heheheh
Thanks,
Dave