Lindenmayer System
A Simple L-system Image Generator Featuring Turtle Graphics
Types.h
Go to the documentation of this file.
1 
4 // MIT License
5 //
6 // Copyright (c) 2020 Ian Parberry
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 
26 #pragma once
27 
28 #include "Includes.h"
29 
31 // Turtle graphics descriptor
32 
33 #pragma region Turtle graphics descriptor
34 
40 
41 class TurtleDesc{
42  public:
43  float m_fAngleDelta = 0;
44  float m_fLength = 8;
45  float m_fLenMultiplier = 1;
46  float m_fPointSize = 1;
47 
48  TurtleDesc(){};
49 
54 
55  TurtleDesc(float angledelta, float len):
56  m_fAngleDelta(float(M_PI)*angledelta/180), m_fLength(len){
57  }; //constructor
58 }; //TurtleDesc
59 
60 #pragma endregion Turtle graphics descriptor
61 
63 // Stack frame
64 
65 #pragma region Stack frame
66 
70 
71 class StackFrame{
72  public:
73  Gdiplus::PointF m_ptPos;
74  float m_fAngle = 0;
75  float m_fLength = 0;
76 
78 
79  StackFrame(){};
80 
86 
87  StackFrame(Gdiplus::PointF pos, float angle, float len):
88  m_ptPos(pos), m_fAngle(angle), m_fLength(len){
89  }; //constructor
90 }; //StackFrame
91 
92 #pragma endregion Stack frame
float m_fPointSize
Line point size.
Definition: Types.h:46
Turtle graphics descriptor.
Definition: Types.h:41
float m_fLength
Length.
Definition: Types.h:75
float m_fAngleDelta
Line angle delta in radians.
Definition: Types.h:43
float m_fAngle
Rotation angle.
Definition: Types.h:74
Useful includes.
StackFrame(Gdiplus::PointF pos, float angle, float len)
Constructor.
Definition: Types.h:87
Stack frame.
Definition: Types.h:71
float m_fLenMultiplier
Line length multiplier.
Definition: Types.h:45
Gdiplus::PointF m_ptPos
Position.
Definition: Types.h:73
StackFrame()
Default constructor.
Definition: Types.h:79
float m_fLength
Line length.
Definition: Types.h:44
TurtleDesc(float angledelta, float len)
Default constructor.
Definition: Types.h:55