aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-09-16 21:19:57 -0400
committerDavid Robillard <d@drobilla.net>2022-09-16 22:31:06 -0400
commit2e4d666eec1a372d4b64c527d6c4945ad98d2b58 (patch)
treea3a61d346c3d4e5b590b08db446d17307df0e3c5 /src
parentbf05ef949750cfca6e001b0f767cd2173441fc8c (diff)
downloadchilbert-2e4d666eec1a372d4b64c527d6c4945ad98d2b58.tar.gz
chilbert-2e4d666eec1a372d4b64c527d6c4945ad98d2b58.tar.bz2
chilbert-2e4d666eec1a372d4b64c527d6c4945ad98d2b58.zip
Update clang-format configuration
Diffstat (limited to 'src')
-rw-r--r--src/chilbert_obj.cpp52
-rw-r--r--src/chilbert_svg.cpp68
2 files changed, 60 insertions, 60 deletions
diff --git a/src/chilbert_obj.cpp b/src/chilbert_obj.cpp
index 0f31fbd..1fdd1ee 100644
--- a/src/chilbert_obj.cpp
+++ b/src/chilbert_obj.cpp
@@ -25,30 +25,30 @@
int
main(int argc, char** argv)
{
- if (argc != 2) {
- fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
- return 1;
- }
-
- const unsigned long num_points = std::strtoul(argv[1], nullptr, 10);
- if (num_points == 0 || num_points == ULONG_MAX) {
- fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
- return 1;
- }
-
- // Vertices
- for (uint64_t i = 0; i < num_points; ++i) {
- std::array<uint32_t, 3> point;
- chilbert::index_to_coords(point, 16, 3, i);
- printf("v %u %u %u\n", point[0], point[1], point[2]);
- }
-
- // One polyline through all vertices
- printf("\nl");
- for (unsigned i = 0; i < num_points - 1; ++i) {
- printf(" %u", i + 1);
- }
- printf("\n");
-
- return 0;
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
+ return 1;
+ }
+
+ const unsigned long num_points = std::strtoul(argv[1], nullptr, 10);
+ if (num_points == 0 || num_points == ULONG_MAX) {
+ fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
+ return 1;
+ }
+
+ // Vertices
+ for (uint64_t i = 0; i < num_points; ++i) {
+ std::array<uint32_t, 3> point;
+ chilbert::index_to_coords(point, 16, 3, i);
+ printf("v %u %u %u\n", point[0], point[1], point[2]);
+ }
+
+ // One polyline through all vertices
+ printf("\nl");
+ for (unsigned i = 0; i < num_points - 1; ++i) {
+ printf(" %u", i + 1);
+ }
+ printf("\n");
+
+ return 0;
}
diff --git a/src/chilbert_svg.cpp b/src/chilbert_svg.cpp
index dd4a3d4..7033bec 100644
--- a/src/chilbert_svg.cpp
+++ b/src/chilbert_svg.cpp
@@ -26,38 +26,38 @@
int
main(int argc, char** argv)
{
- if (argc != 2) {
- fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
- return 1;
- }
-
- const unsigned long num_points = std::strtoul(argv[1], nullptr, 10);
- if (num_points == 0 || num_points == ULONG_MAX) {
- fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
- return 1;
- }
-
- const uint32_t w =
- uint32_t(sqrt(1 << uint32_t(ceil(log2(double(num_points)))))) - 1;
-
- // Header
- printf("<svg xmlns='http://www.w3.org/2000/svg'"
- " version='1.2' baseProfile='tiny' viewBox='0 0 %u %u'>\n",
- w,
- w);
- printf("<desc>Hilbert Curve</desc>\n");
- printf("<polyline vector-effect='non-scaling-stroke' fill='none' "
- "stroke='black' stroke-width='1' points='");
-
- // One polyline through all vertices
- for (uint64_t i = 0; i <= num_points; ++i) {
- std::array<uint32_t, 2> point;
- chilbert::index_to_coords(point, 32, 2, i);
- printf("%u,%u ", point[0], point[1]);
- }
-
- // Close off document
- printf("' />\n</svg>\n");
-
- return 0;
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
+ return 1;
+ }
+
+ const unsigned long num_points = std::strtoul(argv[1], nullptr, 10);
+ if (num_points == 0 || num_points == ULONG_MAX) {
+ fprintf(stderr, "Usage: %s NUM_POINTS\n", argv[0]);
+ return 1;
+ }
+
+ const uint32_t w =
+ uint32_t(sqrt(1 << uint32_t(ceil(log2(double(num_points)))))) - 1;
+
+ // Header
+ printf("<svg xmlns='http://www.w3.org/2000/svg'"
+ " version='1.2' baseProfile='tiny' viewBox='0 0 %u %u'>\n",
+ w,
+ w);
+ printf("<desc>Hilbert Curve</desc>\n");
+ printf("<polyline vector-effect='non-scaling-stroke' fill='none' "
+ "stroke='black' stroke-width='1' points='");
+
+ // One polyline through all vertices
+ for (uint64_t i = 0; i <= num_points; ++i) {
+ std::array<uint32_t, 2> point;
+ chilbert::index_to_coords(point, 32, 2, i);
+ printf("%u,%u ", point[0], point[1]);
+ }
+
+ // Close off document
+ printf("' />\n</svg>\n");
+
+ return 0;
}