example
This commit is contained in:
1 parent
e8ccd877a0
commit
a6b2f6677f
3 files changed
+46
-1
No files matched your search
@@ -0,0 +1,33 @@
|
||||
namespace Algorithms;
|
||||
internal class Triangle
|
||||
|
||||
{
|
||||
|
||||
private Point sommet1;
|
||||
private Point sommet2;
|
||||
private Point sommet3;
|
||||
|
||||
|
||||
|
||||
public Triangle(Point sommet1,Point sommet2,Point sommet3)
|
||||
{
|
||||
this.sommet1 = sommet1;
|
||||
this.sommet2 = sommet2;
|
||||
this.sommet3 = sommet3;
|
||||
}
|
||||
|
||||
public static Triangle Equilateral(double longueur)
|
||||
{
|
||||
|
||||
Point sommet1 = new Point(0,0);
|
||||
Point sommet2 = new Point(0, longueur);
|
||||
|
||||
// H2 = A2 + B2
|
||||
// B = sqrt (H2 - A2)
|
||||
|
||||
double x = Math.Sqrt(longueur*longueur - longueur*longueur/4);
|
||||
Point sommet3 = new Point(x, longueur/2);
|
||||
return new Triangle(sommet1, sommet2, sommet3);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user