Juniper - Libraries

Date: 2025 09-September 17

These are great questions. Your current code is a fantastic conceptual model, but it relies on manual string manipulation and subprocess calls that can be brittle. By introducing a few key libraries, you can make the entire codebase more robust, readable, and professional.

Here are the library recommendations to simplify and "button up" the Juniper project, organized by the part of the pipeline they will benefit.

1. For the Command Line Interface (CLI)

2. For 1_asset_extractor.py (CAD & Data)

3. For 2_renderer_and_exporter.py (Rendering & Export)

4. For 3_svg_to_ovation_translator.py (Ovation Conversion)

By adopting these libraries, you will move from a conceptual prototype to a well-structured, maintainable, and professional open-source project that is ready to attract serious contributors.


Do I need Tensorflow or SciPy?

That is an excellent question and one that gets to the heart of the project's architecture.

Matrix Algebra for Transformations

Yes, at its core, generating different views (isometric, top-down, side) from a single set of coordinates requires matrix algebra.1 Every time you rotate, scale, or translate a point in 2D or 3D space, you are performing a matrix multiplication.

However, you do not need to write these matrix transformations yourself.

This is a key part of why using a dedicated library like D3.js is so beneficial. D3.js has powerful built-in functions that abstract away the complex math.

Why You Do Not Need SciPy or TensorFlow

Libraries like SciPy, TensorFlow, and NumPy are massive, purpose-built libraries for scientific computing, data analysis, and machine learning.2 They are designed for performing complex, large-scale numerical operations on arrays and tensors.

Using these libraries for a simple geometric transformation would be like using a rocket to drive to the grocery store. It is massive overkill, would introduce a huge amount of unnecessary code, and would slow down your pipeline significantly.

The Correct Way to Do It with D3.js

The JavaScript code in 2_renderer_and_exporter.py is the perfect place to handle this. D3.js includes a geoIdentity() method which is perfect for this task. It is designed for geometric transformations and comes with built-in methods for:

You simply apply these methods to the geometric data from your JSON file.

Example Code:

The following is a simplified example of how D3.js handles the transformation. It is the code that would be used in your renderer, replacing the simple placeholder.

JavaScript

// A simple function to apply a transformation.
function applyTransform(x, y, view) {
    let projection;
    if (view === 'isometric') {
        projection = d3.geoIdentity()
            .rotate([45, 0, 0]) // Rotate on the X-Z plane
            .scale(2)
            .translate([100, 50]);
    } else if (view === 'top') {
        projection = d3.geoIdentity()
            .reflectY(true);
    }
    // D3 handles the matrix algebra internally.
    return projection([x, y]);
}

// In your rendering loop:
const transformedPoint = applyTransform(el.position[0], el.position[1], view);
element.attr("cx", transformedPoint[0])
       .attr("cy", transformedPoint[1]);

In summary: