Difference between revisions of "User:Lenny222"
Jump to navigation
Jump to search
(→Lila) |
|||
Line 14: | Line 14: | ||
==== Recursive programming ==== |
==== Recursive programming ==== |
||
* [http://www.typeer.de/thema/Context-Free-Art---Simple-Schoenheit/ ContextFree] |
* [http://www.typeer.de/thema/Context-Free-Art---Simple-Schoenheit/ ContextFree] |
||
+ | |||
+ | ==== Data structures ==== |
||
+ | <haskell> |
||
+ | data Figure = Figure { |
||
+ | fill :: Fill |
||
+ | , shape :: Shape |
||
+ | , stroke :: Stroke |
||
+ | } |
||
+ | |||
+ | data Fill = Fill { |
||
+ | fillPaint :: Paint, |
||
+ | } |
||
+ | |||
+ | data Stroke = Stroke { |
||
+ | strokePaint :: Paint, |
||
+ | , lineWidth :: Double, |
||
+ | , dashPattern :: DashPattern |
||
+ | , lineCap :: LineCap |
||
+ | , lineJoin :: LineJoin |
||
+ | , miterLimit :: Double |
||
+ | } deriving(Eq, Show) |
||
+ | |||
+ | data Paint = |
||
+ | SolidColor |
||
+ | | Pattern |
||
+ | | Gradient |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | data LineCap = |
||
+ | LineCapButt |
||
+ | | LineCapRound |
||
+ | | LineCapSquare |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | data LineJoin = |
||
+ | LineJoinMiter |
||
+ | | LineJoinRound |
||
+ | | LineJoinBevel |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | data Shape = |
||
+ | Path |
||
+ | | Primitive |
||
+ | | Text |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | data Path = Path { |
||
+ | segments :: [Segment] |
||
+ | } |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | data Segment = |
||
+ | Move Point |
||
+ | | Line { |
||
+ | a :: Point |
||
+ | , b :: Point |
||
+ | } |
||
+ | | HorizontalLine { |
||
+ | a :: Point |
||
+ | , w :: Double |
||
+ | } |
||
+ | | VerticalLine { |
||
+ | a :: Point |
||
+ | , h :: Double |
||
+ | } |
||
+ | | QuadraticBezier Point Point Point |
||
+ | | CubicBezier Point Point Point Point |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | data Point = |
||
+ | Node2d Double Double |
||
+ | | Node3d Double Double Double |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | data Primitive = |
||
+ | Circle |
||
+ | | Ellipse |
||
+ | | Rectangle |
||
+ | | RegularPolygon |
||
+ | | Square |
||
+ | | Star |
||
+ | deriving(Eq, Show) |
||
+ | |||
+ | class PathLike a = |
||
+ | convertToPath :: a -> Path |
||
+ | </haskell> |
||
=== Simplified Haskell homepage === |
=== Simplified Haskell homepage === |
Revision as of 16:27, 1 December 2009
Things i think need improvement
Lila
3d projection
Recursive programming
Data structures
data Figure = Figure {
fill :: Fill
, shape :: Shape
, stroke :: Stroke
}
data Fill = Fill {
fillPaint :: Paint,
}
data Stroke = Stroke {
strokePaint :: Paint,
, lineWidth :: Double,
, dashPattern :: DashPattern
, lineCap :: LineCap
, lineJoin :: LineJoin
, miterLimit :: Double
} deriving(Eq, Show)
data Paint =
SolidColor
| Pattern
| Gradient
deriving(Eq, Show)
data LineCap =
LineCapButt
| LineCapRound
| LineCapSquare
deriving(Eq, Show)
data LineJoin =
LineJoinMiter
| LineJoinRound
| LineJoinBevel
deriving(Eq, Show)
data Shape =
Path
| Primitive
| Text
deriving(Eq, Show)
data Path = Path {
segments :: [Segment]
}
deriving(Eq, Show)
data Segment =
Move Point
| Line {
a :: Point
, b :: Point
}
| HorizontalLine {
a :: Point
, w :: Double
}
| VerticalLine {
a :: Point
, h :: Double
}
| QuadraticBezier Point Point Point
| CubicBezier Point Point Point Point
deriving(Eq, Show)
data Point =
Node2d Double Double
| Node3d Double Double Double
deriving(Eq, Show)
data Primitive =
Circle
| Ellipse
| Rectangle
| RegularPolygon
| Square
| Star
deriving(Eq, Show)
class PathLike a =
convertToPath :: a -> Path
Simplified Haskell homepage
A simplified Haskell frontpage
Other programming language homepages:
Contact
Contact me via
q 4 0 9
a t
k u d l i n g
d o t
d e