geom2d-0.2.2: package for geometry in euklidean 2d space

Geom2d.Point

Synopsis

# Documentation

class Point p where Source

Methods

x :: p a -> a Source

y :: p a -> a Source

fromCoords :: a -> a -> p a Source

Instances

 Source Source

data Point' a Source

This data type modells the the characteristics of vectors in 2 dimensional space. You should construct it via `fromCoords`.

Instances

 Source Source Source Source Source Source Eq a => Eq (Point' a) Source Read a => Read (Point' a) Source Show a => Show (Point' a) Source Arbitrary a => Arbitrary (Point' a) Source (Num a, AEq a, RealFloat a) => AEq (Point' a) Source Eq a => Intersect (Point' a) (Point' a) Source

type Triangle p = (p, p, p) Source

A triangle is simply a tuple of three points.

class Scale p where Source

This type class modells data that can be scaled by a factor.

Methods

scale :: Num a => a -> p a -> p a Source

Instances

 Source Source

normalize :: (Scale p, Point p, Eq a, Floating a) => p a -> Maybe (p a) Source

Normalizes a scaleable point to length 1.

scaleTo :: (Scale p, Point p, Eq a, Floating a) => a -> p a -> Maybe (p a) Source

magnitude :: (Point p, Floating a, Num a) => p a -> a Source

Return the magnitude of a vector.

dot :: (Num a, Point p) => p a -> p a -> a infixl 7 Source

This function defines the dot product of two vectors.

cross :: (Num a, Point p) => p a -> p a -> a infixl 7 Source

This function defined the cross product of two vectors.

triArea :: (Point p, Num (p a), Fractional a) => Triangle (p a) -> a Source

Calculate the area of a triangle.

pointInTriangle :: (Eq (p a), Num (p a), Fractional a, Point p, Ord a) => Triangle (p a) -> p a -> Bool Source

Determin whether a point is in a triangle. A point being on the edge is considered inside the triangle.