visualizations

Programmatic visualizations
git clone git://git.laack.co/visualizations.git
Log | Files | Refs | README

commit d1775b107b5d3f7ed2e1eb901f51de042cdfb92a
parent 0683ca6580f7342df93d63425daf710e9f896746
Author: Andrew Laack <andrew@laack.co>
Date:   Tue, 15 Sep 2026 20:35:47 -0500

Marking functions with const / noexcept as applicable.

Diffstat:
Mbackground/headers/edge.hpp | 2+-
Mbackground/headers/graph.hpp | 6+++---
Mbackground/src/edge.cpp | 2+-
Mbackground/src/graph.cpp | 6+++---
Mbackground/src/main.cpp | 2+-
5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/background/headers/edge.hpp b/background/headers/edge.hpp @@ -11,7 +11,7 @@ class Edge { std::size_t v2Index; float length2; bool traversed = false; - std::string toString(); + std::string toString() const noexcept; bool operator<(const Edge& other) const; bool operator>(const Edge& other) const; }; diff --git a/background/headers/graph.hpp b/background/headers/graph.hpp @@ -15,11 +15,11 @@ class Graph { public: // based on the edgeCount and vertCount, random edges and vertices will be created. Graph(std::size_t edgeCount, std::size_t vertCount, uint32_t xMax, uint32_t yMax); - std::string toString(); - void render(); + std::string toString() noexcept; + void render() noexcept; void traverseVertexIdx(std::size_t idx); std::vector<Edge> getEdgesOfVertexIdx(std::size_t idx); void setEdgeTraversed(Edge e); Vertex getVertex(std::size_t idx); - std::size_t getVertexCount(); + std::size_t getVertexCount() const noexcept; }; diff --git a/background/src/edge.cpp b/background/src/edge.cpp @@ -4,7 +4,7 @@ Edge::Edge(std::size_t v1, std::size_t v2, float length2, std::size_t identifier) : v1Index(v1), v2Index(v2), length2(length2), identifier(identifier) {} -std::string Edge::toString() { +std::string Edge::toString() const noexcept { return "(" + std::to_string(this->v1Index) + ", " + std::to_string(this->v2Index) + ")"; } diff --git a/background/src/graph.cpp b/background/src/graph.cpp @@ -39,7 +39,7 @@ Graph::Graph(std::size_t edgeCount, std::size_t vertCount, uint32_t xMax, uint32 } } -std::string Graph::toString() { +std::string Graph::toString() noexcept { std::string result = "edges: {"; @@ -63,7 +63,7 @@ std::string Graph::toString() { } -void Graph::render() { +void Graph::render() noexcept { // yes, this will double draw because we track 0 -> 1 and 1 -> 0 @@ -141,6 +141,6 @@ Vertex Graph::getVertex(std::size_t idx) { } -std::size_t Graph::getVertexCount() { +std::size_t Graph::getVertexCount() const noexcept { return vertices.size(); } diff --git a/background/src/main.cpp b/background/src/main.cpp @@ -13,7 +13,7 @@ int main() { SetTraceLogLevel(LOG_ERROR); srand(clock()); - std::size_t edgeCount = 2000; + std::size_t edgeCount = 500; std::size_t vertCount = 100; auto ss = getScreenSize();