Skip to content

Commit 97612a0

Browse files
committed
+ tiling_export_PaintBoundary() in export_Boundary.c, and many other minor improvements and refactorings.
+ `tiling_export_PaintBoundary()` in export_Boundary.c, and many other minor improvements and refactorings.
1 parent 705351f commit 97612a0

File tree

112 files changed

+235813
-219500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+235813
-219500
lines changed

C/Smalls_SVG.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, April 2025
1+
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, June 2025
22
// Released under GNU General Public License, Version 3, https://www.gnu.org/licenses/gpl-3.0.txt
33
// smalls_SVG.c, in PenroseC
44

55
#include "penrose.h"
66

7-
#define almostZero 5E-10 // consistent with %0.9lf
7+
#define almostZero 5E-10 // consistent with %.9lf
88

99
char * svgTransform(char * const str, double const x, double const y, double const angDeg, short int angMod )
1010
{
@@ -33,22 +33,22 @@ char * svgTransform(char * const str, double const x, double const y, double
3333
if( fabs(x) <= almostZero )
3434
str[0] = 0;
3535
else
36-
sprintf(str, " transform='translate(%0.9lf)'", x);
36+
sprintf(str, " transform='translate(%.9lf)'", x);
3737
} // angDegNew == 0
3838
else
3939
{
4040
if( fabs(x) <= almostZero )
41-
sprintf(str, " transform='rotate(%0.9lf)'", angDegNew);
41+
sprintf(str, " transform='rotate(%.9lf)'", angDegNew);
4242
else
43-
sprintf(str, " transform='translate(%0.9lf) rotate(%0.9lf)'", x, angDegNew);
43+
sprintf(str, " transform='translate(%.9lf) rotate(%.9lf)'", x, angDegNew);
4444
} // angDegNew != 0
4545
} // y == 0
4646
else
4747
{
4848
if( fabs(angDegNew) <= almostZero )
49-
sprintf(str, " transform='translate(%0.9lf,%0.9lf)'", x, y);
49+
sprintf(str, " transform='translate(%.9lf,%.9lf)'", x, y);
5050
else
51-
sprintf(str, " transform='translate(%0.9lf,%0.9lf) rotate(%0.9lf)'", x, y, angDegNew);
51+
sprintf(str, " transform='translate(%.9lf,%.9lf) rotate(%.9lf)'", x, y, angDegNew);
5252
} // y != 0
5353

5454
stringClean(scratchString);
@@ -174,5 +174,3 @@ void exportColourSVG(char * const strA, char * const strB, bool * const isWhit
174174

175175
} // Open
176176
} // exportColourSVG()
177-
178-

C/controls.c

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, April 2025
1+
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, June 2025
22
// Released under GNU General Public License, Version 3, https://www.gnu.org/licenses/gpl-3.0.txt
33
// main.c, in PenroseC
44

@@ -7,7 +7,7 @@
77
// Change to match your directory structure, and location of applications.
88
static char const filePath_staticConst[] = "/Users/JDAW/Documents/outputPenrose/";
99

10-
#define AnyPostProcessing false
10+
#define AnyPostProcessing true
1111

1212
// Location and name of application should match your machine's arrangement. Or can become empty do-nothing.
1313
void execute_SVG_PostProcessing(
@@ -23,9 +23,9 @@ void execute_SVG_PostProcessing(
2323
{
2424
if( ef == SVG_arcs || numCharsThisFile < 10737418240 ) // 10 MiB. Limit very different for arcs and rhombi. https://issues.chromium.org/issues/390969197
2525
{
26-
// Change next line to invoke your preferred browser.
26+
// Change next line to invoke your preferred browser or SVG viewer.
2727
sprintf(scratchString, "open -a '/Applications/Google Chrome.app' 'file://%s'", fileName);
28-
system(scratchString); // In general, system() can be a serious security risk. If concerned, delete.
28+
system(scratchString); // In general, system() can be a serious security risk. If unable to be sure of safety, delete.
2929
} // Not too big
3030
} // AnyPostProcessing
3131
} // execute_SVG_PostProcessing()
@@ -44,7 +44,7 @@ void execute_PostScript_PostProcessing(
4444
{
4545
// Change next line to invoke your preferred PS-to-PDF application, likely either Distiller or GhostScript.
4646
sprintf(scratchString, "open -a '/Applications/Adobe_Acrobat_2020_20240514/Acrobat Distiller.app' '%s'", fileName);
47-
system(scratchString); // In general, system() can be a serious security risk. If concerned, delete.
47+
system(scratchString); // In general, system() can be a serious security risk. If unable to be sure of safety, delete.
4848
} // AnyPostProcessing
4949
} // execute_PostScript_PostProcessing()
5050

@@ -61,27 +61,61 @@ bool exportQ(ExportWhat const exprtWhat, ExportFormat const exportFormat, cons
6161
return( true );
6262

6363
case PS_data:
64-
return( tlngP->tilingId == tlngP->numTilings - 1 );
64+
return(
65+
tlngP->tilingId == tlngP->numTilings - 1 // Last lap only
66+
&& ( tlngP->tilingId <= 15 || exprtWhat != boundingPath ) // At 15, bounding path has 20k points, so array of length about 60k.
67+
);
68+
69+
case PS_rhomb:
70+
case PS_arcs:
71+
return( tlngP->tilingId >= -1 ); // Null condition, always true, easily changed.
6572

6673
case SVG_rhomb:
67-
case SVG_arcs:
68-
return( tlngP->tilingId >= -1 ); // Null condition, always true
74+
if( tlngP->tilingId >= -1 ) // Null condition, always true, easily changed.
75+
{
76+
switch(exprtWhat)
77+
{
78+
case anything:
79+
case rhombi:
80+
return true;
81+
case boundingPath:
82+
return false; // different to SVG_arcs
83+
84+
case pathStats:
85+
case paths:
86+
return false; // This never reached; included to quieten compiler grumbling.
87+
} // switch(exprtWhat)
88+
}
6989

70-
case PS_arcs:
71-
case PS_rhomb:
72-
return( tlngP->tilingId >= -1 ); // Null condition, always true
90+
case SVG_arcs:
91+
if( tlngP->tilingId >= -1 ) // Null condition, always true
92+
{
93+
switch(exprtWhat)
94+
{
95+
case anything:
96+
case rhombi:
97+
case boundingPath:
98+
return true;
99+
100+
case pathStats:
101+
case paths:
102+
return false; // This never reached; included to supress compiler grumbling.
103+
} // switch(exprtWhat)
104+
}
73105

74106
case TSV:
75107
switch(exprtWhat)
76108
{
77-
case Anything:
109+
case anything:
78110
return( 18 + numLinesThisFile < ExcelMaxNumRows );
79111
case pathStats:
80112
return( 10 + numLinesThisFile + tlngP->numPathStats < ExcelMaxNumRows );
81-
case Paths:
113+
case paths:
82114
return( 10 + numLinesThisFile + tlngP->numPathsClosed + tlngP->numPathsOpen < ExcelMaxNumRows - 10240 ); // Leaving space for subsequent pathStats
83-
case Rhombi:
115+
case rhombi:
84116
return( 10 + numLinesThisFile + tlngP->numFats + tlngP->numThins < ExcelMaxNumRows - 10240 ); // Leaving space for subsequent pathStats
117+
case boundingPath:
118+
return( 10 + numLinesThisFile + 5 * sqrt(tlngP->numFats + tlngP->numThins) < ExcelMaxNumRows - 10240 ); // Leaving space for subsequent pathStats
85119
} // switch(exprtWhat)
86120
break; // Redundant
87121

@@ -135,12 +169,18 @@ bool rhombus_keep(
135169
)
136170
{
137171
return true;
138-
// Example alternative:
139-
// return xNorth > (-1 * tlngP->edgeLength);
172+
// Example alternative: return xNorth > (-1 * tlngP->edgeLength);
140173
} // rhombus_keep
141174

142175

143176

177+
bool file_names_include_timeString(void)
178+
{
179+
return false;
180+
} // file_names_include_timeString()
181+
182+
183+
144184
// Wrappers
145185
const char * filePath(void)
146186
{

C/exportPath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, April 2025
1+
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, June 2025
22
// Released under GNU General Public License, Version 3, https://www.gnu.org/licenses/gpl-3.0.txt
33
// exportPath.c, in PenroseC
44

@@ -10,7 +10,7 @@ void path_export(
1010
ExportFormat const exportFormat,
1111
Tiling const * const tlngP,
1212
Path const * const pathP,
13-
int const indentDepth,
13+
int8_t const indentDepth,
1414
bool const notLast,
1515
unsigned long int * const numLinesThisFileP,
1616
unsigned long long int * const numCharsThisFileP

C/exportPathStats.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, April 2025
1+
// By and copyright Julian D. A. Wiseman of www.jdawiseman.com, June 2025
22
// Released under GNU General Public License, Version 3, https://www.gnu.org/licenses/gpl-3.0.txt
33
// exportPathStats.c, in PenroseC
44

@@ -10,7 +10,7 @@ void pathStat_export(
1010
ExportFormat const exportFormat,
1111
const Tiling * const tlngP,
1212
PathStats const * const pathStatP,
13-
int const indentDepth,
13+
int8_t const indentDepth,
1414
bool const notLast,
1515
unsigned long int * const numLinesThisFileP,
1616
unsigned long long int * const numCharsThisFileP

0 commit comments

Comments
 (0)