RectifyingStripPatterns
This is an implementation of the paper "Rectifying Strip Patterns" (SIGGRAPH ASIA 2023). The code is to design rectifying strips with controllable inclinations on surfaces
Install / Use
/learn @wangbolun300/RectifyingStripPatternsREADME
Rectifying Strip Patterns
<img src="./data/fig/code_teaser.png" /> This is an implementation of the paper "Rectifying Strip Patterns" (SIGGRAPH ASIA 2023). The code is implemented in C++, and tested on MSVC and GCC. This is a framework to design rectifying strips/structures, including a scalar field optimization framework, a quad mesh optimization framework, code for optimizing space curves into rectifying strips, etc.Citation
If you use our code in your project, please consider citing the original paper:
@article{Wang:2023:Rectifying,
author = {Wang, Bolun and Wang, Hui and Schling, Eike and Pottmann, Helmut},
title = {Rectifying Strip Patterns},
year = {2023},
issue_date = {December 2023},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {42},
number = {6},
issn = {0730-0301},
url = {https://doi.org/10.1145/3618378},
doi = {10.1145/3618378},
month = {dec},
articleno = {256},
numpages = {18},
keywords = {architectural geometry, computational design, computational fabrication, gridshell, pseudo-geodesic, shading system}
}
Compiling Instruction
To compile the code, first you need to install CMake (https://cmake.org/), To build the executable on Linux or macOS:
cd RectifyingStripPatterns/
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release
make
To build it on MSVC, you need to download openmesh into the "external" folder, unzip it into "external/openmesh/OpenMesh-9.1.0" and build it into "external/openmesh/OpenMesh-9.1.0/build".
Then double-click the executable lsc_devbin, you will see a pop-out window whose buttons link the functions that generate all the results in our paper.
Usage
Some useful shortcuts:
iis to invert the normal directions of the viewer.dis to enable double-sided rendering.xis to delete the selected mesh in theMesh Managementlist.
Some tips:
- Please always check if there is any new mesh added into the
Mesh Managementlist. Sometimes after pressing the buttons, there is no change in the main view window, but the new mesh is already added into the list. To see the renderings of the new results you need to make other meshes invisible by clicking the checker boxes on the left of the mesh files. - Please always check the information printed in the terminal, it will tell you the numerical errors, how to read/write files after pressing the corresponding buttons, if there are singularities, etc.
- Every time you get a scalar field, don't forget to save it using
Save levelset. If you have a scalar field and a model in the framework, close the exe and reopen it before loading another model or scalar field. - When it prints "flip u" in the terminal, it means the convergence is not stable. You should first use a small
weight pseudo geodesic, run a few iterations until it turns stable, then gradually increase the weight. - When it prints "Singularity" in the terminal, it means there are singularities in the scalar field. Enhance the constraints on smoothness and strip width until the singularities disappear.
Interactive design of P-curves
- Press the button
UseUnitScaleMeshon the top left of the viewer to unit-scale the mesh. - Draw the guide curves: Press the key
3on the keyboard, and draw a few curves on the surface using your mouth, then release the key3. Make sure that there is no intersection. The strokes should be smooth, generally in the same direction, as shown below
- If you are not satisfied with the strokes, you can clear the strokes by pressing
Panel 1 -> InterActiveDesign -> ClearStrokes. A clean mesh will be added to theMesh Managementso that you can redraw curves on it. - Press the button
Stroke2LSto confirm the drawing. - Press
AutoRunSmoothto generate the smooth level sets that follow the strokes. The details for each iteration is printed in the terminal. The target P-curve angle $\theta$ is also printed out, e.g. "target_angle, 76.5434". - After obtaining the smooth level sets generally following the strokes, press
AutoRunPG, wait for a few seconds, then the scalar function whose level curves are pseudo-geodesic curves of $\theta$ is generated. PressSave levelsetto save the scalar field and the binormal vectors. In this step, the scalar field is automatically optimized using the default parameters.
Initialize the scalar field by tracing P-curves.
- Open the exe by double-clicking it, there is a default mesh already loaded. If you want to use another mesh, load it by pressing
Import Mesh, delete the default mesh, and now you have a clean workspace. - Trace guide curves using the buttons under the
Tracingcatalog. The start points of tracing curves are on the boundary of the mesh. There are twoTracingTypeyou can choose to quickly decide where the start points are.SegTracechooses a segment that contains "nbr bnd edges" edges of the boundary starting from the "start bnd edge"th edge of the boundary loop. The distance between two neighboring start points is "every i segments". AnotherTracingTypeisOneEdgeTrace. If your mesh has corner points on the boundary, you can select the "Select 1 boundary"th segment of the boundary curve split by the corner points.corner anglehelps to decide the corner points. The following figure shows the traced curves underOneEdgeTracemode.
- Now we trace curves. Set up the
start angleand $\theta$ =target angle, pressTrace Curves, and P-curves will be traced out and rendered in the viewer. - Or, you can also trace 1 curve each time by properly setting up the parameters under
SegTracemode, save and load them one by one. This gives you more precise control of the start directions and curve locations. - Make sure there is no intersection in the traced curves.
- Now we turn to
Energy Solvingcatalog. Tuneweight boundaryandweight laplacianand pressLvSet Optunder theLS Processingcatalog, you will see the generated level sets after running a certain number of iterations decided byIteration. - Save the scalar field if you are satisfied with the quality. See figure: <img src="./data/fig/smooth.png" style="zoom:40%;" />
Optimize for P-curves with user-specific parameters
- Press
Import levelsetto load a scalar field andImport Mesh. - Set up
weight laplacianto control the smoothness,weight Strip widthto control the gradient not far from 1,weight pseudo geodesicfor the $E_{angle}$. Set the checker boxesEnable PG EnergyandEnable Strip Widthas TRUE, then runLvSet Optto optimize for $\theta$ =target angle. The figure below shows P-curves of $\theta = 60^\circ$ and the optimization parameters.
- We recommend you start from large
weight laplacianandweight Strip width, and smallweight pseudo geodesic, then gradually change the parameters as what we showed in the figure above, to improve the stability of optimization. - Note that the errors printed in the terminal are the sqrt of the energy. the example above prints out "pg, 0.00318374" meaning that the error $E_{angle} = 0.00318374^2 =$ 1.01e-5.
- To use $E_{geo}$ and $E_{asy}$ for geodesic and asymptotic instead of $E_{angle}$, you can set
Enable Extreme Casesas TRUE. Iftarget angle= 0,then $E_{asy}$ is enabled; Otherwise, $E_{geo}$ is enabled.
Optimize level sets for AAG.
After obtaining the scalar fields for the two families of asymptotic curves, load the two fields using Load First Level Set and Load Second Level Set, respectively. We call the 3 scalar fields F, H and G, where G is the 3rd scalar field. Now we optimize the 3 scalar fields simultaneously. You can input the parameters as before, and there are some new parameters:
-
weight_geodesicis a ratio of the parameters of G, which means the weights for G are $weight *$weight_geodesic, while for F and H are $weight$. It makes the optimization easier since we can start from a vanishing G and gradually add G back. -
weight boundarynow becomes the weight for the condition $F+H+G=0$. -
Under the catalog
Panel 1 -> TwoLvlStAnglethere are buttons and parameters to set up the angles between the level sets of F and H. For AAG optimization we don't need them since the asymptotic directions are totally decided by the geometry, but for AGG, PPG, etc., the angle constraints can be useful to generate visual-pleasing meshes. Remember to set theWeightAngleOfLSsas small values since they can only be weak constraints. -
Press
AAG lvSetto run the optimizations. You can also pressAGG LvSetto run AGG, orPPG LvSetto run PPG. PressSave AAGto save 3 scalar fields in a row (works for AAG, AGG and PPG). The pseudo-geodesic angles $\theta_F$ and $\theta_G$ for PPG aretarget angleandsecond angle, respectively.
Extracting quad mesh from scalar fields
- Load the two scalar fields:
Load First Level Set,Load Second Level Set. - For nets that only contain two families of curves, press
Ortho Fields Quads, then you can save the generated quad mesh and some mesh structure info files. The number of parameter lines of each scalar field can be controlled byNbr of U linesandNbr of V lines. - For 3-webs like AAG, AGG and PPG, whose diagonals of the quads are also mesh edges, please use
Extr Pace Quad.Nbr of U lineswill control the density. It will sample both the u and v scalar functions with an even pace to make sure $F+H+G=0$. The 3-webs are also saved as quad meshes. The diagonal information is written into
