How to know two lines are a pare parallel lines
- From: "lovecreatesbeauty" <lovecreatesbeauty@xxxxxxxxx>
- Date: 27 Apr 2006 08:36:01 -0700
For example, line L1 and line L2 are two lines in two-dimensional
space, the start-points and end-points can be described with following
the `point_t' type. The start-points and end-points are: Line L1
(L1_str, L1_end), L2 (L2_str, L2_end).
Can I compare the float value of sloping rate of two lines to determine
whether they are parallel lines? Some paper books tell that float value
can not be compared to float value. Some people also try to convince
others on this point that do not perform the comparing on float values.
Then how can I complete the task of determining whether two lines are
parallel lines by their sloping rate?
/* type for points */
typedef struct
{
double x;
double y;
} point_t;
/* calculate the value of sloping rate of a line */
double slope(point_t pt_start, point_t pt_end);
double sl_L1 = slope (L1_str, L1_end);
double s2_L2 = slope (L2_str, L2_end);
if (s1_L1 == s2_L2) /* CAUTION: compare float data to float, is it ok?
*/
{
/* L1 and L2 are parallel lines */
}
else
{
/* L1 and L2 are not parallel lines */
}
--
Sincerely,
lovecreatesbeauty
.
- Follow-Ups:
- Re: How to know two lines are a pare parallel lines
- From: Rouben Rostamian
- Re: How to know two lines are a pare parallel lines
- From: Walter Roberson
- Re: How to know two lines are a pare parallel lines
- From: Martin Ambuhl
- Re: How to know two lines are a pare parallel lines
- Prev by Date: Re: Declaration of Variables: Location
- Next by Date: Re: creating 2 sockets
- Previous by thread: question about array out of bound index
- Next by thread: Re: How to know two lines are a pare parallel lines
- Index(es):
Relevant Pages
|
|