Chart-1.9.3: A library for generating 2D Charts and Plots

Graphics.Rendering.Chart.Geometry

Contents

Description

Synopsis

# Points and Vectors

data Rect #

A rectangle is defined by two points.

Constructors

 Rect Point Point
Instances
 # Instance detailsDefined in Graphics.Rendering.Chart.Geometry MethodsshowsPrec :: Int -> Rect -> ShowS #show :: Rect -> String #showList :: [Rect] -> ShowS #

data Point #

A point in two dimensions.

Constructors

 Point Fieldsp_x :: Double p_y :: Double
Instances
 # Instance detailsDefined in Graphics.Rendering.Chart.Geometry MethodsshowsPrec :: Int -> Point -> ShowS #show :: Point -> String #showList :: [Point] -> ShowS #

data Vector #

A vector in two dimensions.

Constructors

 Vector Fieldsv_x :: Double v_y :: Double
Instances
 # Instance detailsDefined in Graphics.Rendering.Chart.Geometry MethodsshowsPrec :: Int -> Vector -> ShowS #showList :: [Vector] -> ShowS #

type Range = (Double, Double) #

Convert a Point to a Vector.

mkrect :: Point -> Point -> Point -> Point -> Rect #

Create a rectangle based upon the coordinates of 4 points.

Make a path from a rectangle.

pvadd :: Point -> Vector -> Point #

Add a point and a vector.

pvsub :: Point -> Vector -> Point #

Subtract a vector from a point.

psub :: Point -> Point -> Vector #

Subtract two points.

Angle of a vector (counterclockwise from positive x-axis)

Length/magnitude of a vector

Scale a vector by a constant.

within :: Point -> Rect -> Bool #

Test if a point is within a rectangle.

Intersects the rectangles. If they intersect the intersection rectangle is returned. LMin is the empty rectangle / intersection and LMax is the infinite plane.

data RectEdge #

Edge of a rectangle.

Constructors

 E_Top E_Bottom E_Left E_Right

data Limit a #

Constructors

 LMin LValue a LMax
Instances
 Show a => Show (Limit a) # Instance detailsDefined in Graphics.Rendering.Chart.Geometry MethodsshowsPrec :: Int -> Limit a -> ShowS #show :: Limit a -> String #showList :: [Limit a] -> ShowS #

type PointMapFn x y = (Limit x, Limit y) -> Point #

A function mapping between points.

# Paths

data Path #

The path type used by Charts.

A path can consist of several subpaths. Each is started by a MoveTo operation. All subpaths are open, except the last one, which may be closed using the Close operation. When filling a path all subpaths are closed implicitly.

Closing a subpath means that a line is drawn from the end point to the start point of the subpath.

If a Arc (or ArcNeg) is drawn a implicit line from the last end point of the subpath is drawn to the beginning of the arc. Another implicit line is drawn from the end of an arc to the beginning of the next path segment.

The beginning of a subpath is either (0,0) or set by a MoveTo instruction. If the first subpath is started with an arc the beginning of that subpath is the beginning of the arc.

Constructors

 MoveTo Point Path LineTo Point Path Arc Point Double Double Double Path ArcNeg Point Double Double Double Path End Close
Instances
 # Paths are monoids. After a path is closed you can not append anything to it anymore. The empty path is open. Use close to close a path. Instance detailsDefined in Graphics.Rendering.Chart.Geometry Methods(<>) :: Path -> Path -> Path #stimes :: Integral b => b -> Path -> Path # # Instance detailsDefined in Graphics.Rendering.Chart.Geometry Methodsmappend :: Path -> Path -> Path #mconcat :: [Path] -> Path #

lineTo :: Point -> Path #

Move the paths pointer to the given location and draw a straight line while doing so.

moveTo :: Point -> Path #

Move the paths pointer to the given location.

lineTo' :: Double -> Double -> Path #

Short-cut for lineTo, if you don't want to create a Point.

moveTo' :: Double -> Double -> Path #

Short-cut for moveTo, if you don't want to create a Point.

Arguments

 :: Point Center point of the circle arc. -> Double Radius of the circle. -> Double Angle to start drawing at, in radians. -> Double Angle to stop drawing at, in radians. -> Path

Draw the arc of a circle. A straight line connects the end of the previous path with the beginning of the arc. The zero angle points in direction of the positive x-axis. Angles increase in clock-wise direction. If the stop angle is smaller then the start angle it is increased by multiples of 2 * pi until is is greater or equal.

arc' :: Double -> Double -> Double -> Double -> Double -> Path #

Short-cut for arc, if you don't want to create a Point.

arcNeg :: Point -> Double -> Double -> Double -> Path #

Like arc, but draws from the stop angle to the start angle instead of between them.

arcNeg' :: Double -> Double -> Double -> Double -> Double -> Path #

Short-cut for arcNeg, if you don't want to create a Point.

A closed empty path. Closes a path when appended.

Arguments

 :: Monoid m => (Point -> m) MoveTo -> (Point -> m) LineTo -> (Point -> Double -> Double -> Double -> m) Arc -> (Point -> Double -> Double -> Double -> m) ArcNeg -> m Close -> Path Path to fold -> m

Fold the given path to a monoid structure.

Enriches the path with explicit instructions to draw lines, that otherwise would be implicit. See Path for details about what lines in paths are implicit.

# Matrices

Transform a point using the given matrix.

scaleP :: Vector -> Point -> Point #

Scale a point.

rotateP :: Double -> Point -> Point #

Rotate a point around the origin. The angle is given in radians.

Translate a point.

data Matrix #

Copied from Graphics.Rendering.Cairo.Matrix

Constructors

 Matrix Fieldsxx :: !Double yx :: !Double xy :: !Double yy :: !Double x0 :: !Double y0 :: !Double
Instances
 # Copied from Graphics.Rendering.Cairo.Matrix Instance detailsDefined in Graphics.Rendering.Chart.Geometry Methods(+) :: Matrix -> Matrix -> Matrix #(-) :: Matrix -> Matrix -> Matrix #(*) :: Matrix -> Matrix -> Matrix #abs :: Matrix -> Matrix # # Instance detailsDefined in Graphics.Rendering.Chart.Geometry MethodsshowsPrec :: Int -> Matrix -> ShowS #showList :: [Matrix] -> ShowS #

Copied from Graphics.Rendering.Cairo.Matrix

Copied from Graphics.Rendering.Cairo.Matrix Rotations angle is given in radians.

scale :: Vector -> Matrix -> Matrix #