Data.Geometry
- Package
- purescript-geometria
- Repository
- Ebmtranceboy/purescript-geometria
Re-exports from Data.Geometry.Ellipse
#Ellipse Source
newtype Ellipse| ;TLDR : |
| ------ |
| |
| e@ |
| ( |
| Ellipse |
| { center |
| , a |
| , b |
| , c |
| } |
| ) = ellipse center (radiusMax /\ radiusMin) alpha |
| |
| represents the set of points (x/\y) satisfying: |
| |
| a * (x - center.x)^2 |
| + b * (y - center.y)^2 |
| + c * (x - center.x) (y - center.y) - residualConstant(e) |
| = 0 |
| |
| THE ellipse FUNCTION CANNOT REPRESENT AN ELLIPSE |
| PASSING THROUGH THE ORIGIN |
| |
ELLIPSES
Représentations implicites d'ellipses : 5 degrés de liberté
Représentation en ligne de niveau: ................................. f(x,y) = ax2 + by2 + cxy + dx + ey = 1
Représentation par équation matricielle: ....................................... _ _ _ _ | a c/2 d/2 | | x | _ _ | c/2 b e/2 | | y | | x y 1| | d/2 e/2 -1 | | 1 | = X^TAX = 0
Centrage (abandon des termes de degré 1): ........ Changements de variables: x = X+h et y = Y+k tels que f(x,y) = g(X,Y) = aX2 + bY2 + cXY + L => [h; k] = [ec-2bd; cd-2ae] / (4ab-c2) et L = L(a,b,c,d,e,h,k) = ah2 + bk2 + chk + dh + ek. De plus, f(x,y) = 1 => aX2 + bY2 + cXY = l = 1-L. La représentation de l'ellipse peut alors se limiter à: _ _ _ _ _ _ | a c/2 | | x | | x y | | c/2 b | | y | = X^TBX = l
(cf. fonctions ellipseInternal et residualConstant)
- Alignement (abandon du terme couplé, après centrage): .......... Diagonalisation de B, matrice symétrique :
- une matrice diagonale D =[D00, 0; 0, D11] : 2 ddl
- un angle t : 1 ddl => soit 5 ddl avec les 2 ddl du centrage.
(cf. fonction unCouple)
Représentation explicite d'ellipses :
On fait correspondre à tout point (x,y) du cercle trigonométrique, un point (X,Y) de l'ellipse centrée en (h,k) par la transformation affine :
| X | | h | | cos(t) -sin(t) || s0=sqrt(|l/D00|) 0 || x | | Y |=| k |+| sin(t) cos(t) || 0 s1=sqrt(|l/D11|) || y |
dont la partie linéaire s'apparente à une décomposition SVD (si, comme ici, on choisit V=Id, c'est-à-dire que les points cardinaux du cercle unité correspondent aux points extrêmes de l'ellipse). Ainsi, inversement, à toute matrice T=USV', on peut retrouver les paramètres t, s0 et s1 en
- diagonalisant T'T
- orthonormalisant ses vecteurs propres
- prenant la racine carrée de ses valeurs propres.
(cf. fonctions ellipseDimensions et fromUnitCircle)
Constructors
Instances
#unCouple Source
unCouple :: Ellipse -> Number /\ Number /\ NumberEquivalent to the diagonalization of the symmetric input matrix : t est l'angle de rotation autour de l'origine tel que c'=0 dans la nouvelle representation:
- tan(2t) = c/(a-b)
- vec = matrice de rotation d'angle t
- val = recip vec * m * vec = [d00, 0; 0, d11]
#turnEllipse Source
turnEllipse :: Number -> Ellipse -> EllipseRotation adapted to the chosen representation of an ellipse .
#steiner Source
steiner :: Point 2 -> Point 2 -> Point 2 -> EllipseBiggest ellipse in a triangle. Could also be defined with 5 points :
- the 3 segment's middles,
- the intersection of a median and the symmetric of the opposite side with respect to isobarycenter and
- another intersection of a median and the symmetric of the opposite side with respect to isobarycenter.
#residualConstant Source
residualConstant :: Ellipse -> NumberValue of the second member in the updated equation after centering.
#moveEllipse Source
moveEllipse :: Vector 2 -> Ellipse -> EllipseTranslation adapted to the chosen representation of an ellipse .
#fromUnitCircle Source
fromUnitCircle :: Ellipse -> Point 2 -> Point 2Explicit construction of a point of the ellipse from a point of the unit circle such that the four cardinal circular points correspond to the extremities of the axes of the ellipse.
#ellipseInternal Source
ellipseInternal :: Ellipse -> Polynomial (Polynomial Number)#ellipseCenter Source
ellipseCenter :: Ellipse -> Point 2#cardinal Source
cardinal :: Point 2 -> Point 2 -> Number -> EllipseComputes the relevant parts of an ellipse defined by :
- its center
- one of its cardinal points, (this sets the first semi-axis), and
- the length of the other semi-axis. Could also be defined with 5 points :
- the 4 cardinal points,
- a fifth point defined as the sum of two consecutive cardinal vectors, over sqrt(2).
Re-exports from Data.Geometry.Space
#revolution Source
revolution :: Vector 3 -> Number -> Vector 3 -> Vector 3rotation de u d'un angle a autour de l'axe normalisé n
Re-exports from Data.Geometry.Types
#Segment Source
newtype Segment :: Int -> Typenewtype Segment n
Constructors
Instances
Show (Segment n)Metric (Segment n)Intersectable (Segment 2) (Line 2)Intersectable (Line 2) (Segment 2)Intersectable (Segment 2) (HalfLine 2)Intersectable (HalfLine 2) (Segment 2)Intersectable (Segment 2) CircleIntersectable Circle (Segment 2)Intersectable (Segment 2) (Segment 2)
#Line Source
newtype Line :: Int -> Typenewtype Line n
Constructors
Instances
Show (Line n)Intersectable (Line 2) (Line 2)Intersectable (Line 2) (HalfLine 2)Intersectable (HalfLine 2) (Line 2)Intersectable (Line 2) CircleIntersectable Circle (Line 2)Intersectable (Segment 2) (Line 2)Intersectable (Line 2) (Segment 2)
#HalfLine Source
newtype HalfLine :: Int -> Typenewtype HalfLine n
Constructors
Instances
Show (HalfLine n)Intersectable (Line 2) (HalfLine 2)Intersectable (HalfLine 2) (Line 2)Intersectable (HalfLine 2) CircleIntersectable Circle (HalfLine 2)Intersectable (HalfLine 2) (HalfLine 2)Intersectable (Segment 2) (HalfLine 2)Intersectable (HalfLine 2) (Segment 2)
#Analytic Source
class Analytic a whereMembers
fromCoordinates :: Polynomial Number -> atoCoordinates :: a -> Polynomial Numberindex :: a -> Int -> Number
Instances
#Intersectable Source
class Intersectable a b whereMembers
Instances
Intersectable (Line 2) (Line 2)Intersectable (Line 2) (HalfLine 2)Intersectable (HalfLine 2) (Line 2)Intersectable (Line 2) CircleIntersectable Circle (Line 2)Intersectable (HalfLine 2) CircleIntersectable Circle (HalfLine 2)Intersectable Circle CircleIntersectable (HalfLine 2) (HalfLine 2)Intersectable (Segment 2) (Line 2)Intersectable (Line 2) (Segment 2)Intersectable (Segment 2) (HalfLine 2)Intersectable (HalfLine 2) (Segment 2)Intersectable (Segment 2) CircleIntersectable Circle (Segment 2)Intersectable (Segment 2) (Segment 2)
#projection Source
projection :: forall n. Vector n -> Vector n -> Vector nprojection d v projects a vector v on a vector d.
#normalized Source
normalized :: forall n. Vector n -> Vector n#freeVector Source
freeVector :: forall @n. Shape n Vector => Polynomial Number -> Vector n#anyVector2 Source
anyVector2 :: System -> Vector 2