Can anyone help me with this task?

It will be much appreciated! Thanks in advance.

"Énter a triangle and calculate the sine of its maximal angle. The triangle is defined by the coordinates of its vertices. The coordinates are floating-point numbers."
Last edited on
3D or 2D?

Read coordinates.
Calculate. Simple vector math. Dot products.
Show result.
I'm not sure. That's why I was hoping someone was kind enough to write the code.

Ace94 wrote:
I was hoping someone was kind enough to write the code.

We are not so much kind that we'll write entire code :)


Yes, use vector maths for 2D or 3D to calculate as keskiverto already suggested.
Mirage, just curious, for this post, can you not make your own function?
To find the dot product of three vectors, it would be U*V*W right? Can't seem to recall it
What would the dot product of 3 vectors represent?

With 2 vectors, the dot product is cos(theta)*len(A)*len(B).. but with 3... ???
Can anyone help me with this? I am willing to pay 3$ to the first that helps me. (Please PM me)
This is one way to do it (and this is for free):

1. From the the coordinates of the vertices, calculate the lengths of the three sides of the triangle.
http://www.mathsisfun.com/algebra/distance-2-points.html

2. The maximal angle is the angle opposite the longest side.

3. Use the law of cosines to determine the cosines of the interior angle opposite to the longest side.
http://en.wikipedia.org/wiki/Law_of_cosines

4. Use the Pythagorean identity to compute its sine.
http://en.wikipedia.org/wiki/Pythagorean_trigonometric_identity


A task like that is clearly homework. The sole purpose of homework is that you do learn. You do learn by doing.

Therefore, think. Do one step at a time. Use the knowledge that you already have and write code.

http://en.wikipedia.org/wiki/Cross_product#Geometric_meaning
Topic archived. No new replies allowed.