STL export¶
Turning a Riemann relief into a printable mesh. See the physical workflow.
complexplorer.OrnamentGenerator ¶
OrnamentGenerator(func: Callable, resolution: int = 150, scaling: str | None = None, scaling_params: dict[str, Any] | None = None, cmap: Colormap | None = None, domain: Domain | None = None, *, normalize: str | float | None = DEFAULT_NORMALIZE, pointiness: float = DEFAULT_POINTINESS, pole_order: float = DEFAULT_POLE_ORDER, sharpness: float | None = None, contrast: tuple[float, float] | None = None)
Generate 3D-printable ornaments from complex functions.
This version directly uses the modulus-scaled mesh from the Riemann sphere visualization without complex healing steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
callable
|
Complex function f(z) to visualize. |
required |
resolution
|
int
|
Mesh resolution (n_theta = n_phi). |
150
|
scaling
|
str
|
Modulus scaling method. Defaults to |
None
|
scaling_params
|
dict
|
Parameters for the scaling method. Anything given here wins over the values derived from
|
None
|
cmap
|
Colormap
|
Colormap for visualization. Default is Phase colormap. |
None
|
domain
|
Domain
|
Domain to restrict evaluation. Helps avoid numerical issues. |
None
|
normalize
|
(geometric, median)
|
How to rescale |
'geometric'
|
pointiness
|
float
|
Tip sharpness, as the reciprocal of the tip exponent: the surface approaches a feature like
|
2.0
|
pole_order
|
float
|
The order of the features being shaped. Scaling the transfer by it makes a double pole print
as sharp as a simple one instead of twice as blunt. The resulting scale is capped at
|
1.0
|
sharpness
|
float
|
The log-modulus scale, set directly, bypassing |
None
|
contrast
|
tuple of (float, float)
|
|
None
|
Initialize ornament generator.
from_preset
classmethod
¶
Build a generator from a catalog preset, honouring the relief settings it carries.
A printable preset records the order of its features and the resolution its detail needs. Rendering it without those gives the blunt version of the piece: the tip exponent is the feature order divided by the transfer's scale, and the scale is derived from the order, so an order-2 piece rendered as order 1 comes out as an exact cone where a cusp was intended.
Anything passed in overrides wins over the preset, so a caller can explore a piece at a
lower resolution or a different sharpness without editing the catalog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preset
|
FunctionPreset
|
A preset from |
required |
**overrides
|
Any :class: |
{}
|
Returns:
| Type | Description |
|---|---|
OrnamentGenerator
|
|
Examples:
generate_ornament ¶
Generate the ornament mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbose
|
bool
|
Print progress information. |
False
|
Returns:
| Type | Description |
|---|---|
PolyData
|
Generated ornament mesh with color information. |
validate_mesh ¶
Validate mesh for 3D printing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size_mm
|
float
|
Target size in millimeters. |
50
|
verbose
|
bool
|
Print validation results. |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Validation results. |
save_stl ¶
save_stl(filename: str, size_mm: float = 50, center: bool = True, repair: bool = True, binary: bool = True, validate: bool = True, verbose: bool = True, size_measure: str = 'extent') -> str
Save the ornament as STL file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Output filename (should end with .stl). |
required |
size_mm
|
float
|
Scale mesh to this size in millimeters, measured per |
50
|
size_measure
|
(extent, max)
|
What |
'extent'
|
center
|
bool
|
Center the mesh at origin. |
True
|
repair
|
bool
|
Apply simple mesh repair (fill holes). |
True
|
binary
|
bool
|
Save as binary STL (smaller file size). |
True
|
validate
|
bool
|
Validate before saving. |
True
|
verbose
|
bool
|
Print progress information. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Path to saved file. |
generate_and_save ¶
generate_and_save(filename: str, size_mm: float = 50, center: bool = True, repair: bool = True, binary: bool = True, validate: bool = True, verbose: bool = True, size_measure: str = 'extent') -> str
Generate ornament and save as STL in one step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Output filename. |
required |
size_mm
|
float
|
Target size in millimeters, measured per |
50
|
size_measure
|
(extent, max)
|
What |
'extent'
|
center
|
bool
|
Center the mesh. |
True
|
repair
|
bool
|
Apply simple mesh repair. |
True
|
binary
|
bool
|
Use binary STL format. |
True
|
validate
|
bool
|
Validate before saving. |
True
|
verbose
|
bool
|
Print progress. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Path to saved file. |
complexplorer.create_ornament ¶
create_ornament(func: Callable, filename: str, size_mm: float = 50, resolution: int = 150, scaling: str | None = None, scaling_params: dict[str, Any] | None = None, cmap: Colormap | None = None, domain: Domain | None = None, verbose: bool = True, *, size_measure: str = 'extent', normalize: str | float | None = DEFAULT_NORMALIZE, pointiness: float = DEFAULT_POINTINESS, pole_order: float = DEFAULT_POLE_ORDER, sharpness: float | None = None, contrast: tuple[float, float] | None = None) -> str
Create a 3D-printable ornament from a complex function.
Convenience function for creating STL files from complex functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
callable
|
Complex function to visualize. |
required |
filename
|
str
|
Output STL filename. |
required |
size_mm
|
float
|
Size in millimeters, measured per |
50
|
size_measure
|
(extent, max)
|
What |
'extent'
|
resolution
|
int
|
Mesh resolution. |
150
|
scaling
|
str
|
Modulus scaling method. Defaults to the ornament transfer, a logistic in the log modulus. |
None
|
scaling_params
|
dict
|
Scaling parameters. |
None
|
cmap
|
Colormap
|
Color mapping. |
None
|
domain
|
Domain
|
Domain restriction. |
None
|
verbose
|
bool
|
Print progress. |
True
|
normalize
|
str | float | None
|
Relief shaping, passed through to :class: |
DEFAULT_NORMALIZE
|
pointiness
|
str | float | None
|
Relief shaping, passed through to :class: |
DEFAULT_NORMALIZE
|
pole_order
|
str | float | None
|
Relief shaping, passed through to :class: |
DEFAULT_NORMALIZE
|
sharpness
|
str | float | None
|
Relief shaping, passed through to :class: |
DEFAULT_NORMALIZE
|
contrast
|
str | float | None
|
Relief shaping, passed through to :class: |
DEFAULT_NORMALIZE
|
Returns:
| Type | Description |
|---|---|
str
|
Path to saved STL file. |