How to Adjust Edge Scaling for Quads in AutoRemesher

Set the scaling parameter via AutoRemesher::AutoRemesher::setScaling() before starting the remesh process, where values greater than 1.0 stretch edges and values less than 1.0 compress them.

AutoRemesher is an open-source quad mesh generation tool that converts triangle meshes into clean quad layouts. When you need to control the density or size of the resulting quads, you can adjust edge scaling for quads in AutoRemesher through its parameterization system, which modifies how the algorithm stretches or shrinks edges during UV field construction.

Understanding Edge Scaling in AutoRemesher

Edge scaling controls the target length of edges in the generated quad mesh relative to the input geometry. The parameter is stored internally as m_scaling within the Parameterizer class, with a default value of 1.0 representing no scaling.

When you increase the scaling factor above 1.0, the algorithm interprets this as a request for longer edges, effectively reducing quad density and creating larger faces. Conversely, values below 1.0 produce shorter edges and denser quad layouts. This scaling factor is applied during the UV parameterization phase, influencing the field that drives final quad extraction.

Where Edge Scaling Is Stored and Applied

The edge scaling parameter flows through three architectural layers in the huxingyi/autoremesher codebase:

Core Parameterizer Storage (src/AutoRemesher/parameterizer.h)

The actual scaling value resides in the Parameterizer class as a private member variable:

// src/AutoRemesher/parameterizer.h#L52
void setScaling(double scaling) {
    m_scaling = scaling;
}

The m_scaling member directly influences the UV field construction algorithm, scaling edge lengths before quad extraction occurs.

Public API Access (src/AutoRemesher/autoremesher.h)

The AutoRemesher class exposes a public setter to configure the parameterizer:

// src/AutoRemesher/autoremesher.h#L55
void AutoRemesher::setScaling(double scaling);

This is the primary entry point for programmatically adjusting edge scaling when using AutoRemesher as a library.

Frontend Bridge (src/quadmeshgenerator.cpp)

The Qt-based QuadMeshGenerator acts as the intermediary between user interfaces and the core engine:

// src/quadmeshgenerator.cpp#L61
if (m_parameters.scaling > 0)
    m_autoRemesher->setScaling(m_parameters.scaling);

This code forwards the user-defined scaling value from the Parameters struct to the core remesher instance.

Three Methods to Adjust Edge Scaling

You can modify the edge scaling parameter through the GUI, command line, or direct API calls.

GUI Method (Preferences Dialog)

When using the Qt interface, the scaling value is exposed through a spin box typically found in the preferences or settings panel. The UI enforces a practical range of 0.1 to 5.0 with 0.1 increments:

auto scalingSpin = new QDoubleSpinBox(this);
scalingSpin->setRange(0.1, 5.0);
scalingSpin->setSingleStep(0.1);
scalingSpin->setValue(currentParameters.scaling);
connect(scalingSpin, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
        [this](double v){ currentParameters.scaling = v; });

The value is stored in QuadMeshGenerator::Parameters::scaling and automatically passed to the remesher when generation begins.

CLI Method (Command Line Arguments)

For batch processing or automated pipelines, use the --scaling argument handled in main.cpp:

./autoremesher --scaling 1.5 input.obj output.obj

The command-line parser injects this value into QuadMeshGenerator::Parameters before the remeshing process starts.

Programmatic Method (Direct API)

When embedding AutoRemesher in your own C++ applications, call setScaling() directly on your AutoRemesher instance:

AutoRemesher::AutoRemesher remesher;
remesher.setScaling(1.5);  // Increase edge lengths by 50%

This method provides the most control for custom tools and scripted workflows.

Code Examples

Standalone C++ Implementation

Below is a complete example showing how to configure edge scaling when using AutoRemesher as a library:

#include <AutoRemesher/AutoRemesher>
#include "quadmeshgenerator.h"

int main() {
    // Prepare input mesh data
    std::vector<AutoRemesher::Vector3> vertices = /* ... */;
    std::vector<std::vector<size_t>> triangles = /* ... */;

    // Configure parameters with custom scaling
    QuadMeshGenerator::Parameters params;
    params.scaling = 1.5;               // Stretch edges by 50%
    params.targetTriangleCount = 2000;  // Optional remeshing target

    // Initialize and run generator
    QuadMeshGenerator generator(vertices, triangles, params);
    generator.process();                // Runs in worker thread

    // Retrieve generated quads
    auto quads = generator.takeRemeshedQuads();   // std::vector<std::vector<size_t>>
}

Qt UI Integration

For developers extending the AutoRemesher GUI, connect UI controls to the parameter system:

// In your preferences dialog implementation
void setupScalingControl() {
    auto scalingSpin = new QDoubleSpinBox(this);
    scalingSpin->setRange(0.1, 5.0);
    scalingSpin->setSingleStep(0.1);
    scalingSpin->setValue(currentParameters.scaling);
    
    connect(scalingSpin, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
            [this](double v){ 
                currentParameters.scaling = v; 
            });
}

When the user triggers remeshing, QuadMeshGenerator::generate() automatically forwards currentParameters.scaling to the core engine via m_autoRemesher->setScaling().

Summary

  • Edge scaling controls quad density by modifying target edge lengths during UV parameterization, with m_scaling defaulting to 1.0 in src/AutoRemesher/parameterizer.h.
  • Three entry points exist for adjusting the parameter: the GUI preferences dialog (0.1–5.0 range), the --scaling CLI argument, or direct calls to AutoRemesher::setScaling().
  • Data flow runs from QuadMeshGenerator::Parameters through src/quadmeshgenerator.cpp#L61 to the core AutoRemesher class and ultimately to the Parameterizer.
  • Values above 1.0 produce larger, sparser quads, while values below 1.0 create denser meshes with smaller faces.

Frequently Asked Questions

What is the default edge scaling value in AutoRemesher?

The default value is 1.0, defined as the initial value for m_scaling in the Parameterizer class. This represents neutral scaling where edge lengths remain proportional to the input mesh's geometric features.

How does edge scaling affect the final quad mesh?

The scaling factor is applied during UV field construction in the parameterization phase. Values greater than 1.0 stretch the UV coordinates, resulting in fewer, larger quads, while values less than 1.0 compress the field and increase quad density. This directly impacts the resolution and regularity of the output mesh.

According to the Qt frontend implementation in the huxingyi/autoremesher repository, the practical range is 0.1 to 5.0. Values below 0.1 may produce unstable UV parameterizations, while values above 5.0 typically result in overly coarse meshes that lose geometric detail.

Can I adjust edge scaling after remeshing has started?

No. The scaling parameter must be set before calling process() or generate() on the remesher instance. Once the AutoRemesher begins the isotropic remeshing and parameterization pipeline, the scaling value is locked and cannot be modified for that generation pass.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →