No description
  • Astro 66.5%
  • TypeScript 27.5%
  • JavaScript 3.2%
  • CSS 2.8%
Find a file
Joris Schelfhout f25cf10875 refactor: simplify VectorScene component and remove unnecessary complexity
- Remove Scene.astro component (now obsolete)
- Streamline VectorScene configuration and rendering
- Reduce animation and movement complexity
- Simplify vector and scene setup
- Update default vector values in index page
2025-02-08 03:01:35 +01:00
.vscode Initial commit from Astro 2025-02-07 18:03:04 +01:00
public Initial commit from Astro 2025-02-07 18:03:04 +01:00
src refactor: simplify VectorScene component and remove unnecessary complexity 2025-02-08 03:01:35 +01:00
.gitignore Initial commit from Astro 2025-02-07 18:03:04 +01:00
astro.config.mjs Set up Tailwind CSS, TypeScript, and project structure 2025-02-07 22:21:08 +01:00
bun.lock refactor: scene architecture and layout 2025-02-08 01:58:05 +01:00
package.json refactor: scene architecture and layout 2025-02-08 01:58:05 +01:00
README.md Set up Tailwind CSS, TypeScript, and project structure 2025-02-07 22:21:08 +01:00
tailwind.config.mjs Set up Tailwind CSS, TypeScript, and project structure 2025-02-07 22:21:08 +01:00
tsconfig.json Set up Tailwind CSS, TypeScript, and project structure 2025-02-07 22:21:08 +01:00

Prj-solar-system

The goal of this project is to learn mathmatical concepts in a practical way by building a solar system. In addition I'm going to be taking my first steps in rendering 3D environments, aiming to become better at understanding 3D environments and rendering.

Hopefully the end result will be a dynamic solar system simulation that I can use as reference for how to combine mathmatical concepts to create dynamic and interactive 3D animations.

Tech Stack

  • Astro
  • TailwindCSS
  • TypeScript
  • Babylon JS
  • Plain JS Webcomponents (See example below)

Webcomponents Example

<!-- Wrap the component elements in our custom element “astro-heart”. -->
<astro-heart>
  <button aria-label="Heart">💜</button> × <span>0</span>
</astro-heart>

<script>
  // Define the behaviour for our new type of HTML element.
  class AstroHeart extends HTMLElement {
    connectedCallback() {
      let count = 0;

      const heartButton = this.querySelector('button');
      const countSpan = this.querySelector('span');

      // Each time the button is clicked, update the count.
      heartButton.addEventListener('click', () => {
        count++;
        countSpan.textContent = count.toString();
      });
    }
  }

  // Tell the browser to use our AstroHeart class for <astro-heart> elements.
  customElements.define('astro-heart', AstroHeart);
</script>

Project Plan

1. Setting Up the Foundation

  • Step 1: Create a new Astro project with the default configuration.
  • Step 2: Set up TypeScript support by adding necessary configurations and dependencies.
  • Step 3: Initialize the basic structure of the project, including components and layouts.

2. Mathematics Core

  • Objective: Develop a set of reusable TypeScript classes to handle mathematical operations required for 3D modeling.
  • Tasks:
    • Vector Mathematics:
      • Create Vector class with methods for vector operations (addition, subtraction, dot product, cross product).
      • Implement normalization and length calculations.
    • Matrix Operations:
      • Develop a Matrix class supporting matrix creation (identity, rotation, scaling) and multiplication.
    • Transformations:
      • Create utility functions for:
        • Rotation matrices (around X, Y, Z axes).
        • Scaling operations.
        • Translation operations.
  • Output: Modular TypeScript classes in separate files (vector.ts, matrix.ts, etc.) with clear documentation.

3. Babylon.js Components

  • Objective: Build reusable components that leverage Babylon.js for 3D modeling and rendering.
  • Tasks:
    • Basic Setup:
      • Integrate Babylon.js into the project by adding it as a dependency.
      • Set up basic configurations and initialization for the 3D canvas.
    • Core Components:
      • Create Scene component to manage the 3D scene.
      • Develop Camera component with controls for navigation.
      • Implement Lighting component for different light sources (ambient, directional, point lights).
    • Mesh Operations:
      • Build components for creating basic shapes (sphere, cube, cylinder) using Babylon.js primitives.
      • Add support for custom meshes and loading external models.
  • Output: Collection of reusable components in src/components with clear documentation.

4. Integration

  • Objective: Combine the mathematical utilities and Babylon.js components into functional modules within the Astro project.
  • Tasks:
    • Integrate the core math classes into the Babylon.js components to handle transformations, rendering, and user interactions.
    • Ensure seamless communication between the mathematical operations and 3D visualization.
  • Output: Working modules that demonstrate the integration of math utilities with 3D components.

5. Testing and Documentation

  • Tasks:
    • Write unit tests for the core math classes using testing frameworks like Jest or Jasmine.
    • Document each class, method, and component with clear usage instructions and examples.
    • Create integration tests to ensure the combined modules work as expected.
  • Output: Comprehensive test suite and documentation ensuring ease of use and maintainability.

6. Final Adjustments

  • Tasks:
    • Optimize performance by reviewing and improving critical paths in the codebase.
    • Refactor any overly complex or repetitive code to improve readability and scalability.
    • Add error handling and logging for better debugging and user experience.
  • Output: Final polished and production-ready codebase.