| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Rzk.Render.Geometry
Description
The geometry behind the SVG rendering of cubes, and nothing else.
Rzk renders a (sub)shape of a cube as an SVG diagram: the vertices, edges and
faces of the unit cube are projected to the plane through a camera, and each
of them is labelled with the term that inhabits it. This module holds the part
of that story which knows nothing about terms: the projection matrices, the
camera, and renderCube, which draws a cube given only a function saying what
(if anything) to draw on each of its parts.
Nothing here mentions the type checker, so it is shared by both term representations during the free-foil migration.
Synopsis
- type PointId = String
- type ShapeId = [PointId]
- type Point2D a = (a, a)
- type Point3D a = (a, a, a)
- type Edge3D a = (Point3D a, Point3D a)
- type Face3D a = (Point3D a, Point3D a, Point3D a)
- type Volume3D a = (Point3D a, Point3D a, Point3D a, Point3D a)
- data CubeCoords2D a b = CubeCoords2D {}
- data Matrix3D a = Matrix3D a a a a a a a a a
- data Matrix4D a = Matrix4D a a a a a a a a a a a a a a a a
- data Vector3D a = Vector3D a a a
- data Vector4D a = Vector4D a a a a
- rotateX :: Floating a => a -> Matrix3D a
- rotateY :: Floating a => a -> Matrix3D a
- rotateZ :: Floating a => a -> Matrix3D a
- data Camera a = Camera {
- cameraPos :: Point3D a
- cameraFoV :: a
- cameraAspectRatio :: a
- cameraAngleY :: a
- cameraAngleX :: a
- viewRotateX :: Floating a => Camera a -> Matrix4D a
- viewRotateY :: Floating a => Camera a -> Matrix4D a
- viewTranslate :: Num a => Camera a -> Matrix4D a
- project2D :: Floating a => Camera a -> Matrix4D a
- matrixVectorMult4D :: Num a => Matrix4D a -> Vector4D a -> Vector4D a
- matrix3Dto4D :: Num a => Matrix3D a -> Matrix4D a
- fromAffine :: Fractional a => Vector4D a -> (Point2D a, a)
- point3Dto2D :: Floating a => Camera a -> a -> Point3D a -> (Point2D a, a)
- data RenderObjectData = RenderObjectData {}
- limitLength :: Int -> String -> String
- hideTermData :: Bool -> String -> RenderObjectData -> RenderObjectData
- renderCube :: (Floating a, Show a) => Camera a -> a -> (String -> Maybe RenderObjectData) -> String
- defaultCamera :: Floating a => Camera a
Documentation
type PointId = String Source #
The name of a vertex of the unit cube, as a string of coordinates
(e.g. "010").
type ShapeId = [PointId] Source #
The name of a subshape of the unit cube: its vertices, in order, joined by
dashes (e.g. "000-011" for an edge, "000" for a vertex).
data CubeCoords2D a b Source #
Constructors
| Camera | |
Fields
| |
fromAffine :: Fractional a => Vector4D a -> (Point2D a, a) Source #
data RenderObjectData Source #
What to draw on one part (vertex, edge or face) of a cube.
Constructors
| RenderObjectData | |
hideTermData :: Bool -> String -> RenderObjectData -> RenderObjectData Source #
Apply the term-hiding policy to a cell's render data: drop the <title>
(the full term) from every cell, and blank the visible label of a
proof-coloured (interior) cell. Boundary cells (coloured otherwise) keep
their given labels. A no-op when not hiding.
renderCube :: (Floating a, Show a) => Camera a -> a -> (String -> Maybe RenderObjectData) -> String Source #
defaultCamera :: Floating a => Camera a Source #