HilVert  1v2
A demo of the Hilbert Curve in SVG.
HilVert.cpp File Reference

Implementation of the HilVert class. More...

#include <cstddef>
#include <cstdlib>
#include "HilVert.hpp"
Include dependency graph for HilVert.cpp:

Go to the source code of this file.

Typedefs

using Hen = HilVert::HVenm
 

Functions

auto & operator^= (Hen &e, const bool &b)
 Swap clockwise with anticlock on condition. More...
 
auto & operator++ (Hen &e)
 Turn to the right of the current heading. More...
 
Hen & operator-- (Hen &e)
 Turn to the left of the current heading. More...
 

Variables

constexpr auto right = Hen::right
 
constexpr auto down = Hen::down
 
constexpr auto left = Hen::left
 
constexpr auto up = Hen::up
 
constexpr auto stard = Hen::stard
 
constexpr auto anticlock = Hen::anticlock
 
constexpr auto clockwise = Hen::clockwise
 
constexpr auto alike = Hen::alike
 
constexpr auto widdershins = Hen::widdershins
 

Detailed Description

The HilVert class generates the SVG code needed to draw Hilbert Curves of 12th. order, or below. Within your own C++ code you can #include "HilVert.hpp" and create at least one HilVert object. Use constructor arguments to select the curve options (there are four) you need, or call cmndLn() to modify the defaults. Then call draw() or grfc().

HilVert. The first is programmatically, as a free-standing

See HilVert.hpp for usage.

There are two ways to use HilVert. The first is programmatically; as a stand-alone class that you can include in a larger C++ project. See HilVert.hpp for usage.

Note: To setup the command line arguments for tests under XCode hit

Product:Scheme:Edit_Scheme and select the Arguments tab.

See also -

https://en.wikipedia.org/wiki/Hilbert_curve The enum HilVert::HVenm :

  • errNone
  • errArgc
  • errOrder
  • errHdng
  • errRotat
  • errFile
  • errUknown
  • right
  • down
  • left
  • up
  • stard
  • anticlock
  • clockwise
  • alike
  • widdershins

Definition in file HilVert.cpp.

Typedef Documentation

◆ Hen

Definition at line 86 of file HilVert.cpp.

Function Documentation

◆ operator++()

auto& operator++ ( Hen &  e)
Pre-call e Return
right down
down left
left up
up right
Parameters
eThe enumerator specifying the current heading. May be one of HilVert::HVenm::right, HilVert::HVenm::down, HilVert::HVenm::left or HilVert::HVenm::up ,
Returns
The new heading, 90 degrees right (clockwise) of the previous.

Definition at line 212 of file HilVert.cpp.

◆ operator--()

Hen& operator-- ( Hen &  e)
Pre-call e Return
right up
down right
left down
up left
Parameters
eThe enumerator specifying the current heading. May be one of HilVert::HVenm::right, HilVert::HVenm::down, HilVert::HVenm::left or HilVert::HVenm::up ,
Returns
The new heading, 90 degrees left (anticlockwise) of the previous.

Definition at line 241 of file HilVert.cpp.

◆ operator^=()

auto& operator^= ( Hen &  e,
const bool &  b 
)

Predicated reversal of rotation direction.

Pre-call e b Post-call e
anticlock false anticlock
clockwise false clockwise
anticlock true clockwise
clockwise true anticlock
Parameters
eThe enumerator specifying a current rotation. May be either HilVert::HVenm::clockwise or HilVert::HVenm::anticlock.
bSet true if the rotation is to be reversed, or set false if the rotation must remain unchanged.
Returns
e The enumerator after any change.

Definition at line 187 of file HilVert.cpp.

Variable Documentation

◆ alike

constexpr auto alike = Hen::alike
constexpr

Definition at line 96 of file HilVert.cpp.

◆ anticlock

constexpr auto anticlock = Hen::anticlock
constexpr

Definition at line 94 of file HilVert.cpp.

◆ clockwise

constexpr auto clockwise = Hen::clockwise
constexpr

Definition at line 95 of file HilVert.cpp.

◆ down

constexpr auto down = Hen::down
constexpr

Definition at line 90 of file HilVert.cpp.

◆ left

constexpr auto left = Hen::left
constexpr

Definition at line 91 of file HilVert.cpp.

◆ right

constexpr auto right = Hen::right
constexpr

Definition at line 89 of file HilVert.cpp.

◆ stard

constexpr auto stard = Hen::stard
constexpr

Definition at line 93 of file HilVert.cpp.

◆ up

constexpr auto up = Hen::up
constexpr

Definition at line 92 of file HilVert.cpp.

◆ widdershins

constexpr auto widdershins = Hen::widdershins
constexpr

Definition at line 97 of file HilVert.cpp.