infinity_model 0.0.3 copy "infinity_model: ^0.0.3" to clipboard
infinity_model: ^0.0.3 copied to clipboard

A Flutter package for visualizing and manipulating multi-dimensional datasets, developed in collaboration with Infinity Modeling Labs.

InfinityModel: Advanced Multi-Dimensional Modeling Library #

A Flutter package for visualizing and manipulating multi-dimensional datasets, developed in collaboration with Infinity Modeling Labs.

Preface #

InfinityModel was created to push the boundaries of mathematical visualization by enabling the exploration and analysis of higher-dimensional spaces through intuitive projections and transformations. While it excels at displaying traditional 3D datasets, its true power lies in its ability to represent and manipulate higher-dimensional mathematical structures.

Table of Contents #

Higher Dimensional Mathematics #

InfinityModel provides sophisticated tools for working with higher-dimensional spaces:

Dimensional Projections #

  • 4D Visualization: Project 4D objects into 3D space using advanced projection techniques
  • Cross-sectional Analysis: Examine slices of higher-dimensional objects
  • Interactive Exploration: Rotate and manipulate objects in higher dimensions

Mathematical Foundations #

  • Vector Spaces: Support for n-dimensional vector operations
  • Transformation Groups: Implementation of higher-dimensional rotation and transformation groups
  • Differential Geometry: Tools for analyzing curved spaces and manifolds

Applications in Research #

  • Topology exploration and visualization
  • Complex system analysis
  • Mathematical modeling of higher-dimensional phenomena
  • Data visualization in machine learning and statistical analysis

Integration with Infinity Modeling Labs #

InfinityModel is deeply integrated with Infinity Modeling Labs' ecosystem:

Core Features #

  • Advanced Algorithms: Access to Infinity Labs' proprietary mathematical algorithms
  • Data Pipeline: Seamless integration with Infinity Labs' computational engines
  • Research Tools: Support for advanced mathematical research and analysis

Collaborative Features #

Getting Started #

Installation #

Add InfinityModel to your pubspec.yaml:

dependencies:
  infinity_model: ^latest_version

Basic Setup #

Import the necessary packages:

import 'package:infinity_model/infinity_model.dart';
import 'package:vector_math/vector_math_64.dart';

Create your first higher-dimensional visualization:

InfinityModel(
    figures: models,
    config: InfinityModelConfig(
      perspective: true,
      dimension: 4, // Support for higher dimensions
    ),
    controller: InfinityModelController(),
)

Working with Higher Dimensions #

Create and manipulate higher-dimensional objects:

// Create a 4D hypercube
final hypercube = Model3D.fromHigherDimension(
  vertices: hypercubeVertices,
  indices: hypercubeIndices,
  dimension: 4,
);

// Apply 4D rotation
controller.rotate4D(angle: math.pi / 4, plane: RotationPlane.xw);

And voilà, a single cube will be displayed:

Cube3D

Note: InfinityModel takes full available size. Wrap in SizedBox or Expanded to control its constraints and size.

Controller #

InfinityModelController controls scene rotation, scale, lighting, and higher dimensional transformations.

To set up a controller, keep its reference in a state and pass to the controller parameter.

// in a state
@override
void initState() {
    super.initState();
    controller = InfinityModelController();
}

InfinityModel(
    figures: [
        Cube3D(2, Vector3(0, 0, 0)),
    ],
    controller: controller,
)

Once ready, update controller state by calling:

controller.update(rotationY: 30, rotationX: 30);

Cube3D

To handle input gestures, InfinityModel provides built-in gesture handling through its controller:

InfinityModel(
    figures: figures,
    controller: controller,
    config: InfinityModelConfig(
        enableRotation: true,
        enableZoom: true,
        enablePan: true,
    ),
)

The controller automatically handles:

  • Rotation with drag gestures
  • Zoom with pinch gestures
  • Pan with two-finger drag
  • Higher dimensional rotations with specialized gestures

Config #

InfinityModelConfig defines component defaults and behavior settings including mesh properties, visualization parameters, and higher dimensional settings.

InfinityModel(
    figures: [
        Cube3D(2, Vector3(0, 0, 0)),
    ],
    config: InfinityModelConfig(
        supportZIndex: false,
    ),
)

If a huge dataset is displayed and you don't bother about paint order, it's recommended to disable z-index which boosts drawing speed (supportZIndex = false).

Shapes #

InfinityModel out-of-the-box supports shapes like:

Cube3D #

A cube that can include text labels on any face or vertex.

InfinityModel(
    figures: [
        Cube3D(
          2, 
          Vector3(0, 0, 0),
          text: "Labeled Cube",  // Main label
          textStyle: TextStyle(color: Colors.white),
          faceLabels: {
            CubeFace.front: "Front",
            CubeFace.top: "Top",
            CubeFace.right: "Right",
          },
          vertexLabels: {
            0: "V1",  // Label specific vertices
            4: "V5",
          },
          labelStyle: TextStyle(
            fontSize: 12,
            backgroundColor: Colors.black54,
          ),
        ),
    ],
)

Cube3D

Face3D #

Face (aka triangle).

InfinityModel(
    figures: [
        Face3D(
            Triangle.points(
                Vector3(0, 0 - 1, 0 - 1),
                Vector3(0, 0 - 1, 0 + 1),
                Vector3(0, 0 + 1, 0 + 1),
            ),
        ),
    ],
)

Face3D

Group3D #

Groups a list of figures with optional group labeling.

InfinityModel(
    figures: [
        Group3D(
          [
            Cube3D(1, Vector3(0, 0, 0)),
            Cube3D(1, Vector3(3, 3, 3)),
          ],
          text: "Cube Group",  // Group label
          textStyle: TextStyle(
            color: Colors.white,
            fontSize: 18,
          ),
          textPosition: Vector3(1.5, 1.5, 1.5),  // Custom label position
          showBoundingBox: true,  // Optional bounding box
          boundingBoxLabel: "Group Bounds",  // Label for bounding box
        ),
    ],
)

Group3D

An alternative method to display multiple shapes, it to put a few figures:

InfinityModel(
    figures: [
        Cube3D(1, Vector3(0, 0, 0)),
        Cube3D(1, Vector3(-3, 0, 0)),
        Cube3D(1, Vector3(3, 0, 0)),
        Cube3D(1, Vector3(0, -3, 0)),
        Cube3D(1, Vector3(0, 3, 0)),
        Cube3D(1, Vector3(0, 0, -3)),
        Cube3D(1, Vector3(0, 0, 3)),
    ],
)

Multiple figures

Line3D #

A line with optional text label at any position along the line.

InfinityModel(
    figures: [
      // Basic lines with different widths
      Line3D(
        Vector3(0, 1, 0), 
        Vector3(2, 1, 4), 
        width: 8,
        text: "Thick line",  // Text label
        textPosition: 0.5,   // Position along line (0.0 to 1.0)
        textStyle: TextStyle(color: Colors.white),
      ),
      Line3D(
        Vector3(0, 2, 0), 
        Vector3(2, 2, 4), 
        width: 6,
        text: "Line with offset",
        textOffset: Vector3(0, 0.5, 0),  // Offset from line
      ),
      // Line with multiple labels
      Line3D.withLabels(
        Vector3(0, 3, 0), 
        Vector3(2, 3, 4), 
        width: 4,
        labels: [
          LineLabel(
            text: "Start",
            position: 0.0,
            style: TextStyle(color: Colors.green),
          ),
          LineLabel(
            text: "Middle",
            position: 0.5,
            style: TextStyle(color: Colors.yellow),
          ),
          LineLabel(
            text: "End",
            position: 1.0,
            style: TextStyle(color: Colors.red),
          ),
        ],
      ),
    ],
)

Line3D

Mesh3D #

A mesh made of faces (triangles). You could use ObjParser to load it from .obj file contents. Currently, only material (mtl) as colours are supported.

Load from a string obj content:

InfinityModel(
    figures: [
        Mesh3D(await ObjParser().parse(meshLines)),
    ],
)

Load from a flutter resource:

InfinityModel(
    figures: [
        Mesh3D(await ObjParser().loadFromResources("assets/model.obj")),
    ],
)

Load from a file:

InfinityModel(
    figures: [
        Mesh3D(await ObjParser().loadFromFile(Uri.parse("files/model.obj"))),
    ],
)

Torus Terrain

Plane3D #

A plane facing x (left/right), y (bottom/up) or z (near/far) axis, with optional text labels and grid annotations.

InfinityModel(
    figures: [
        Plane3D(
          5, 
          Axis3D.y, 
          false, 
          Vector3(0, 0, 0),
          color: Colors.green,
          text: "XZ Plane",  // Main plane label
          textStyle: TextStyle(
            color: Colors.white,
            fontSize: 16,
          ),
          gridLabels: true,  // Show coordinate labels on grid
          axisLabels: ["X", "Z"],  // Custom axis labels
          labelStyle: TextStyle(
            color: Colors.white70,
            fontSize: 10,
          ),
          customLabels: {
            Vector2(2, 2): "Point (2,2)",  // Label specific points
            Vector2(-2, -2): "Point (-2,-2)",
          },
        ),
    ],
)

Plane3D

Point3D #

A point in 3D space that can optionally display a text label with customizable positioning and styling.

InfinityModel(
    figures: [
        // Basic point with text
        Point3D(
            position: Vector3(0, 0, 0),
            color: Colors.blue,
            width: 5,
            text: "Origin", // Optional text label
            textStyle: TextStyle(
                color: Colors.white,
                fontSize: 14,
                fontWeight: FontWeight.bold,
            ),
        ),
        
        // Point with custom text positioning
        Point3D(
            position: Vector3(2, 2, 2),
            color: Colors.red,
            width: 5,
            text: "Point A",
            textStyle: TextStyle(color: Colors.red),
            textOffset: Vector3(0.5, 0.5, 0), // Offset the text position
            textAlignment: TextAlign.left,     // Text alignment
            textRotation: true,                // Auto-rotate text with camera
        ),
        
        // Point with multi-line text
        Point3D(
            position: Vector3(-2, -2, -2),
            color: Colors.green,
            width: 5,
            text: "Point B\nCoordinates: (-2, -2, -2)",
            textStyle: TextStyle(
                color: Colors.green,
                height: 1.2,  // Line height for multi-line text
            ),
            textBackground: true,              // Add background to text
            textBackgroundColor: Colors.black.withOpacity(0.5),
        ),
    ],
)

Features:

  • Customizable point appearance (color, size, shape)
  • Optional text labels with full styling support
  • Text positioning with offset and alignment
  • Auto-rotation of text with camera view
  • Multi-line text support
  • Optional text background for better visibility
  • Support for mathematical notation in text using LaTeX syntax

Point3D

PointPlane3D #

A plane made of points (e.g. to show an object) scale.

InfinityModel(
    figures: [
      PointPlane3D(1, Axis3D.y, 0.1, Vector3(0, 0, 0), pointWidth: 5),
      Cube3D(0.1, Vector3(0, 0, 0)),
    ],
)

PointPlane3D

Transformations #

Points and wireframes #

Each figure could be changed to points or lines (wireframe).

InfinityModel(
    figures: [
      ...Plane3D(5, Axis3D.z, false, Vector3(0, 0, 0)).toPoints(),
    ],
)
InfinityModel(
    figures: [
      ...Plane3D(5, Axis3D.z, false, Vector3(0, 0, 0)).toLines(),
    ],
)

Lines

Matrix transformation #

Figures might be rotated, translated, and scaled with TransformModifier3D and Matrix4.

Each transformation is made for 0,0,0 coordinates.

InfinityModel(
    figures: [
        TransformModifier3D(
            Cube3D(2, Vector3(1, 1, 1)),
            Matrix4.identity()
              ..setRotationX(10)
              ..setRotationY(10)
              ..setRotationZ(10)),
    ],
)

Transformation

To rotate the figure around its "own" position, you must translate, rotate and translate back.

InfinityModel(
    figures: [
        Cube3D(2, Vector3(0, 0, 0)),
        TransformModifier3D(
            Cube3D(2, Vector3(2, 2, 2)),
            Matrix4.identity()
              ..translate(2.0, 2.0, 2.0)
              ..rotateZ(10)
              ..rotateX(10)
              ..translate(-2.0, -2.0, -2.0)),
    ],
)

Transformation

Transform Group3D to apply a matrix to each figure.

InfinityModel(
    figures: [
        Cube3D(2, Vector3(0, 0, 0)),
        TransformModifier3D(
          Group3D([
            Cube3D(2, Vector3(2, 2, 2)),
            Cube3D(2, Vector3(4, 4, 4)),
          ]),
          transformation,
        ),
    ],
)

Transformation

Benchmarks #

TBD

const like = 'sample';

Advanced Usage with Infinity Modeling Labs #

Integration with Lab Tools #

InfinityModel is designed to work seamlessly with Infinity Modeling Labs' suite of tools:

// Connect to Infinity Labs' computational engine
final engine = await InfinityLabsEngine.connect();

// Load complex mathematical models
final model = await engine.loadModel('complex_manifold.iml');

// Visualize with InfinityModel
InfinityModel(
    figures: model.toFigures(),
    config: InfinityModelConfig(
        labsIntegration: true,
        computationalEngine: engine,
    ),
)

Research Applications #

  1. Topological Analysis

    // Analyze manifold properties
    final manifold = await TopologyAnalyzer.analyze(model);
    
  2. Complex System Visualization

    // Visualize phase space
    final phaseSpace = await ComplexSystemVisualizer.create(
      dimension: 6,
      parameters: systemParameters,
    );
    
  3. Data Science Integration

    // Project high-dimensional data
    final projection = await DataProjector.project(
      data: highDimensionalData,
      method: ProjectionMethod.tSNE,
    );
    

Contributing #

We welcome contributions from the mathematical and scientific computing community. Please see our Contribution Guidelines for more information.

Support #

License #

This project is licensed under the terms of our research-friendly license. See LICENSE for more details.

About Infinity Modeling Labs #

Infinity Modeling Labs is dedicated to advancing the field of mathematical visualization and modeling. Our mission is to make complex mathematical concepts accessible through cutting-edge visualization tools and computational engines.

2
likes
150
points
4
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter package for visualizing and manipulating multi-dimensional datasets, developed in collaboration with Infinity Modeling Labs.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

collection, flutter, stack_trace, vector_math

More

Packages that depend on infinity_model