Re:[OT] [C] Please critique my code
From: Marlene Stebbins (stebbins_at_email.com)
Date: 04/19/04
- Next message: Sonia: "Re: what is a compound class - got it"
- Previous message: Sonia: "Re: what is a compound class"
- In reply to: Francis Glassborow: "Re: [C] Please critique my code"
- Next in thread: Francis Glassborow: "Re: [OT] [C] Please critique my code"
- Reply: Francis Glassborow: "Re: [OT] [C] Please critique my code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 19 Apr 2004 19:29:40 GMT
Francis Glassborow wrote:
> Heron's formula is hardly the most appropriate when dealing with
> triangles specified with Cartesian co-ordinates. Much better is to
> remember some vector geometry when the problem becomes trivial The area
> of a triangle is half the vector product of a pair of vectors that
> defines the triangle. I will leave further work to you as anyone who
> wishes to ace a course should be able to do their own research once they
> have been given a nudge in the right direction.
Is this what you mean?
If vertex A is located at the origin (0, 0) of a Cartesian
coordinate system and the coordinates of the other two vertices
are given by B = (x1, y1) and C = (x2, y2), then the area S can
be computed as 1/2 times the absolute value of the determinant
|x1 x2|
| |
|y1 y2|
or S = ½ |x1y2 - x2y1|.
This doesn't seem difficult but it is beyond the scope of the
math I have taken so far, so perhaps I haven't understood it
properly. If one of the vertices must be located at the origin of
the system, it won't do, since this condition would rarely be
satisfied. Furthermore, I can't see how this method is more
appropriate to the problem than Heron's formula. Unless you can
show me why it is, I think, with all due respect, that I will
stick with my original approach.
Best regards,
Marlene
- Next message: Sonia: "Re: what is a compound class - got it"
- Previous message: Sonia: "Re: what is a compound class"
- In reply to: Francis Glassborow: "Re: [C] Please critique my code"
- Next in thread: Francis Glassborow: "Re: [OT] [C] Please critique my code"
- Reply: Francis Glassborow: "Re: [OT] [C] Please critique my code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|