# \#math

**URL:** https://discourse.threejs.org/tag/math/431.md

[Latest](https://discourse.threejs.org/latest.md) · [Categories](https://discourse.threejs.org/categories.md) · [Tags](https://discourse.threejs.org/tags.md)

---

## [Optimisation for LOD](https://discourse.threejs.org/t/optimisation-for-lod/93591)

<div class="topic-metadata">

**Author:** [@bobWinner](https://discourse.threejs.org/u/bobWinner)\
**Replies:** 11\
**Last updated:** [August 20, 2026, 4:22pm UTC](https://discourse.threejs.org/t/optimisation-for-lod/93591 "2026-08-20T16:22:28Z")

</div>

I was having some conversation with chatgpt and he gave me this nice optimisation for LOD. the trick is to avoid Math.sqrt() when updating by using distanceToSquared instead of distanceTo. simply store the squared dist…

---

## [Perfectly aligning an interactive CSS3D terminal inside a curved WebGL CRT monitor](https://discourse.threejs.org/t/perfectly-aligning-an-interactive-css3d-terminal-inside-a-curved-webgl-crt-monitor/90601)

<div class="topic-metadata">

**Author:** [@Matthew\_Nader](https://discourse.threejs.org/u/Matthew_Nader)\
**Replies:** 7\
**Last updated:** [April 9, 2026, 12:37pm UTC](https://discourse.threejs.org/t/perfectly-aligning-an-interactive-css3d-terminal-inside-a-curved-webgl-crt-monitor/90601 "2026-04-09T12:37:11Z")

</div>

Hi everyone, I recently built an interactive 3D terminal portfolio, and I wanted to share the rendering architecture, specifically how I handled the occlusion between WebGL and CSS3D. :red\_circle: Live Demo: https://ma…

---

## [Best approach for magnetic snapping with hole validation using empty Object3D markers? Raycasting +Normals or](https://discourse.threejs.org/t/best-approach-for-magnetic-snapping-with-hole-validation-using-empty-object3d-markers-raycasting-normals-or/89792)

<div class="topic-metadata">

**Author:** [@Parisa\_Shahbazi](https://discourse.threejs.org/u/Parisa_Shahbazi)\
**Replies:** 4\
**Last updated:** [February 12, 2026, 12:43pm UTC](https://discourse.threejs.org/t/best-approach-for-magnetic-snapping-with-hole-validation-using-empty-object3d-markers-raycasting-normals-or/89792 "2026-02-12T12:43:47Z")

</div>

Project Summary I’m working on a 3D robotics construction (Robotic) platform for kids (ages 8-14) using Three.js. The project has been in development for a while, and I recently joined the team to implement new fea…

---

## [MathView - curves and surfaces editor](https://discourse.threejs.org/t/mathview-curves-and-surfaces-editor/81148)

<div class="topic-metadata">

**Author:** [@yesbird](https://discourse.threejs.org/u/yesbird)\
**Replies:** 3\
**Last updated:** [January 12, 2026, 2:53am UTC](https://discourse.threejs.org/t/mathview-curves-and-surfaces-editor/81148 "2026-01-12T02:53:22Z")

</div>

Greetings ! I want to show you my latest project - editor for curves and surfaces with XR support: MathView. It can be used by students for exploring surface behaviour or by designers to get unusual geometry for their …

---

## [3D Single-Stage Rocket Simulation for my CSI-370 Final Project](https://discourse.threejs.org/t/3d-single-stage-rocket-simulation-for-my-csi-370-final-project/88385)

<div class="topic-metadata">

**Author:** [@DerisO22](https://discourse.threejs.org/u/DerisO22)\
**Replies:** 0\
**Last updated:** [December 2, 2025, 5:26am UTC](https://discourse.threejs.org/t/3d-single-stage-rocket-simulation-for-my-csi-370-final-project/88385 "2025-12-02T05:26:03Z")

</div>

3D Launch Simulation Github Repo This is the final project I’m working on for my CSI-370: Computer Architecture course. The goal is to get the rocket into Low Earth Orbit (~7.8 km/s and 300m altitude). I decided to use…

---

## [The Atlas: A procedural Universe Simulation built in Python + ThreeJS](https://discourse.threejs.org/t/the-atlas-a-procedural-universe-simulation-built-in-python-threejs/87119)

<div class="topic-metadata">

**Author:** [@SurceBeats](https://discourse.threejs.org/u/SurceBeats)\
**Replies:** 8\
**Last updated:** [September 23, 2025, 7:24am UTC](https://discourse.threejs.org/t/the-atlas-a-procedural-universe-simulation-built-in-python-threejs/87119 "2025-09-23T07:24:53Z")

</div>

Hey Three.js community! I’ve been working on The Atlas for the past couple years and wanted to share it with you all. It’s a real-time procedural universe that generates infinite cosmic structures without any pre-stored …

---

## [3D Image Evolution via Partial Differential Equations](https://discourse.threejs.org/t/3d-image-evolution-via-partial-differential-equations/84357)

<div class="topic-metadata">

**Author:** [@agarnung](https://discourse.threejs.org/u/agarnung)\
**Replies:** 6\
**Last updated:** [June 23, 2025, 9:28pm UTC](https://discourse.threejs.org/t/3d-image-evolution-via-partial-differential-equations/84357 "2025-06-23T21:28:18Z")

</div>

Hi, First of all, thanks to the three.js community for enabling projects like this. I’ve developed an interactive 3D visualization that demonstrates image evolution under partial differential equations (PDEs), powered …

---

## [Changing rimlight shader math to achieve a specific look](https://discourse.threejs.org/t/changing-rimlight-shader-math-to-achieve-a-specific-look/83678)

<div class="topic-metadata">

**Author:** [@grml](https://discourse.threejs.org/u/grml)\
**Replies:** 5\
**Last updated:** [June 6, 2025, 2:17pm UTC](https://discourse.threejs.org/t/changing-rimlight-shader-math-to-achieve-a-specific-look/83678 "2025-06-06T14:17:30Z")

</div>

I’ve adapted this fresnel rimlight shader I found a while ago in this forum. For my use case it would look better if the rimlight was independent from the view angle, i. e. at a fixed angle and sharp falloff, no matt…

---

## [How to render text containing math equations generated from Latex?](https://discourse.threejs.org/t/how-to-render-text-containing-math-equations-generated-from-latex/20716)

<div class="topic-metadata">

**Author:** [@oat](https://discourse.threejs.org/u/oat)\
**Replies:** 11\
**Last updated:** [June 4, 2025, 7:13am UTC](https://discourse.threejs.org/t/how-to-render-text-containing-math-equations-generated-from-latex/20716 "2025-06-04T07:13:56Z")

</div>

May I ask if there is a way to show or render text contents containing math equations generated from Latex syntax? One example is the python library Manim-lib which can render animation containing math equations, mainly…

---

## [Question about math/Plane.js](https://discourse.threejs.org/t/question-about-math-plane-js/79103)

<div class="topic-metadata">

**Author:** [@shlomi](https://discourse.threejs.org/u/shlomi)\
**Replies:** 0\
**Last updated:** [March 6, 2025, 5:13pm UTC](https://discourse.threejs.org/t/question-about-math-plane-js/79103 "2025-03-06T17:13:29Z")

</div>

I find the implementation of an implicit Plane type in Three.js a bit confusing. A positive constant value offsets the plane from the origin in the negative Y direction. This can be visualized using a PlaneHelper: const…

---

## [(Closed - we are now reviewing applications) - Looking for a Three.js developer (maintain and develop existing project)](https://discourse.threejs.org/t/closed-we-are-now-reviewing-applications-looking-for-a-three-js-developer-maintain-and-develop-existing-project/78400)

<div class="topic-metadata">

**Author:** [@rokdazone](https://discourse.threejs.org/u/rokdazone)\
**Replies:** 12\
**Last updated:** [February 25, 2025, 9:20pm UTC](https://discourse.threejs.org/t/closed-we-are-now-reviewing-applications-looking-for-a-three-js-developer-maintain-and-develop-existing-project/78400 "2025-02-25T21:20:12Z")

</div>

Closed We are currently in the process of reviewing applications (we are no longer considering new applications) we will reply to everyone but it could take a while, so please be patient. Thank you for your participati…

---

## [How can I calculate the rotation of the drei PIvotControls with respect to its own rotation](https://discourse.threejs.org/t/how-can-i-calculate-the-rotation-of-the-drei-pivotcontrols-with-respect-to-its-own-rotation/59945)

<div class="topic-metadata">

**Author:** [@leo2](https://discourse.threejs.org/u/leo2)\
**Replies:** 5\
**Last updated:** [February 25, 2025, 7:16pm UTC](https://discourse.threejs.org/t/how-can-i-calculate-the-rotation-of-the-drei-pivotcontrols-with-respect-to-its-own-rotation/59945 "2025-02-25T19:16:35Z")

</div>

I am using drei Pivot Controls to allow the user to move an object. I set the initial rotation of the Pivot Controls (rotation={getPivotControlsRotation()}) to be aligned with the box geometry. And everything works great…

---

## [Procedurally Generated Heart In Three.JS](https://discourse.threejs.org/t/procedurally-generated-heart-in-three-js/6074)

<div class="topic-metadata">

**Author:** [@Phred](https://discourse.threejs.org/u/Phred)\
**Replies:** 14\
**Last updated:** [February 15, 2025, 4:09pm UTC](https://discourse.threejs.org/t/procedurally-generated-heart-in-three-js/6074 "2025-02-15T16:09:40Z")

</div>

Hey all, I’ve been slowly learning JavaScript on the side and wanted to try and animate this with Three.JS: I was trying to re-create that equation but ran into a wall in that the code below is not producing the righ…

---

## [How to use easing functions to improve lerp/slerp](https://discourse.threejs.org/t/how-to-use-easing-functions-to-improve-lerp-slerp/40766)

<div class="topic-metadata">

**Author:** [@r0bert0](https://discourse.threejs.org/u/r0bert0)\
**Replies:** 11\
**Last updated:** [January 10, 2025, 3:35pm UTC](https://discourse.threejs.org/t/how-to-use-easing-functions-to-improve-lerp-slerp/40766 "2025-01-10T15:35:31Z")

</div>

Hey, I am animating a gltf skeleton dynamically and interpolating between position, rotation, scale for each bone. Using lerp and slerp works, but it still looks very sudden and unnatural, so I have been trying to use …

---

## [Math experts: is there anything you wish Three.js math library had?](https://discourse.threejs.org/t/math-experts-is-there-anything-you-wish-three-js-math-library-had/74612)

<div class="topic-metadata">

**Author:** [@trusktr](https://discourse.threejs.org/u/trusktr)\
**Replies:** 7\
**Last updated:** [December 2, 2024, 10:51am UTC](https://discourse.threejs.org/t/math-experts-is-there-anything-you-wish-three-js-math-library-had/74612 "2024-12-02T10:51:43Z")

</div>

Hello math experts, I’m just curious, are there any operations, for example for Matrix4, Quaternion, etc, that you sometimes wish Three.js included? And are there other libraries (even in other languages) that show these…

---

## [Rubik's Cube Solver and Editor](https://discourse.threejs.org/t/rubiks-cube-solver-and-editor/37149)

<div class="topic-metadata">

**Author:** [@EntityPlantt](https://discourse.threejs.org/u/EntityPlantt)\
**Replies:** 2\
**Last updated:** [October 13, 2024, 10:57am UTC](https://discourse.threejs.org/t/rubiks-cube-solver-and-editor/37149 "2024-10-13T10:57:31Z")

</div>

A Rubik’s Cube solver and editor. It can: input a cube (color picker) solve your cube randomize a cube simulate a cube (with rotators) Link: Rubik's Cube Created by: Nikola Stojkovski (me) Filip Kalkashliev Looki…

---

## [Box3 Bounding Box](https://discourse.threejs.org/t/box3-bounding-box/57497)

<div class="topic-metadata">

**Author:** [@Tibi](https://discourse.threejs.org/u/Tibi)\
**Replies:** 8\
**Last updated:** [September 10, 2024, 3:44pm UTC](https://discourse.threejs.org/t/box3-bounding-box/57497 "2024-09-10T15:44:34Z")

</div>

I am trying to understand this and I do but I need to understand it better from a mathematical point, is there any article or video about this subject I could not find anything concrete. Thank you!

---

## [2D transform matrix to map 4 source points to 4 destination points](https://discourse.threejs.org/t/2d-transform-matrix-to-map-4-source-points-to-4-destination-points/68539)

<div class="topic-metadata">

**Author:** [@myro](https://discourse.threejs.org/u/myro)\
**Replies:** 1\
**Last updated:** [July 25, 2024, 2:55am UTC](https://discourse.threejs.org/t/2d-transform-matrix-to-map-4-source-points-to-4-destination-points/68539 "2024-07-25T02:55:10Z")

</div>

Hi all, I’m trying to make a 2D perspective transform matrix that maps 4 source points to 4 destination points. I think I’m doing something backward but I can’t pinpoint my error. I’m using mathjs for solving the syst…

---

## [Advance according to a vector system](https://discourse.threejs.org/t/advance-according-to-a-vector-system/65815)

<div class="topic-metadata">

**Author:** [@Telphn](https://discourse.threejs.org/u/Telphn)\
**Replies:** 7\
**Last updated:** [May 30, 2024, 7:15am UTC](https://discourse.threejs.org/t/advance-according-to-a-vector-system/65815 "2024-05-30T07:15:32Z")

</div>

Hello, I’m working on game design. I’m trying to create a 2D vector system for movement (if it’s tilted), but it’s not working as I’d like. The forums haven’t addressed this question yet. Here is the code for my 3D, con…

---

## [Box3.setFromObject(parent): scene.add(box) vs. parent.add(box)](https://discourse.threejs.org/t/box3-setfromobject-parent-scene-add-box-vs-parent-add-box/64817)

<div class="topic-metadata">

**Author:** [@cdxj](https://discourse.threejs.org/u/cdxj)\
**Replies:** 7\
**Last updated:** [May 1, 2024, 10:46pm UTC](https://discourse.threejs.org/t/box3-setfromobject-parent-scene-add-box-vs-parent-add-box/64817 "2024-05-01T22:46:29Z")

</div>

Hello, Can someone please explain the logic behind the .add() function? The documentation isn’t very clear on this. I am trying to create a child bounding box and add it to the parent object from which the bounding box…

---

## [How to modify the source code of TorusGeometry to close both ends?](https://discourse.threejs.org/t/how-to-modify-the-source-code-of-torusgeometry-to-close-both-ends/64297)

<div class="topic-metadata">

**Author:** [@Joe\_Perry](https://discourse.threejs.org/u/Joe_Perry)\
**Replies:** 4\
**Last updated:** [April 22, 2024, 9:58am UTC](https://discourse.threejs.org/t/how-to-modify-the-source-code-of-torusgeometry-to-close-both-ends/64297 "2024-04-22T09:58:54Z")

</div>

Hi everyone, I’m trying to modify the source code of TorusGeometry in Three.js in order to make the rendered torus closed on both ends. I have looked at the source code of CylinderGeometry and I understand that the key …

---

## [Computing direction from a point to another](https://discourse.threejs.org/t/computing-direction-from-a-point-to-another/63921)

<div class="topic-metadata">

**Author:** [@Nico\_B](https://discourse.threejs.org/u/Nico_B)\
**Replies:** 3\
**Last updated:** [April 10, 2024, 2:00pm UTC](https://discourse.threejs.org/t/computing-direction-from-a-point-to-another/63921 "2024-04-10T14:00:42Z")

</div>

how come that the vector drawn in magenta does not point towards “e” when drawn from “S”?? it’s been puzzling me for days now… I need to compute the quaternion between green and blue lines using setFromUnitVectors. …

---

## [TBN frame to quaternion](https://discourse.threejs.org/t/tbn-frame-to-quaternion/63837)

<div class="topic-metadata">

**Author:** [@dubois](https://discourse.threejs.org/u/dubois)\
**Replies:** 6\
**Last updated:** [April 9, 2024, 6:46pm UTC](https://discourse.threejs.org/t/tbn-frame-to-quaternion/63837 "2024-04-09T18:46:03Z")

</div>

I am trying to convert 3 basis vectors to a rotation. My expectation is that: const rotationMatrix = new THREE.Matrix4().set( 0.3511234415884646, 0.9363291775690172, 0, 0, 0.9363291775690172, -0.3511234415884646…

---

## [Questions about Math](https://discourse.threejs.org/t/questions-about-math/63842)

<div class="topic-metadata">

**Author:** [@wangChen9988](https://discourse.threejs.org/u/wangChen9988)\
**Replies:** 6\
**Last updated:** [April 9, 2024, 9:40am UTC](https://discourse.threejs.org/t/questions-about-math/63842 "2024-04-09T09:40:31Z")

</div>

The following code(the most important part) can achieve the programming effect I want // params.count ： Number of points // params.branch : Number of lines // params.radius : The radius of the shape const generateGala…

---

## [3D visualization of Fractal Brownian Motion configurable with datgui](https://discourse.threejs.org/t/3d-visualization-of-fractal-brownian-motion-configurable-with-datgui/63170)

<div class="topic-metadata">

**Author:** [@marianpekar](https://discourse.threejs.org/u/marianpekar)\
**Replies:** 0\
**Last updated:** [March 23, 2024, 9:13am UTC](https://discourse.threejs.org/t/3d-visualization-of-fractal-brownian-motion-configurable-with-datgui/63170 "2024-03-23T09:13:40Z")

</div>

A swarm of icosahedrons that is semi-randomly distributed and animated across Fractal Brownian Motion noise curves; configurable with datgui. live: https://marianpekar.github.io/fbm-space/ github: https://github.com/ma…

---

## [How to get model rotation angle from 0 to 360 while using transform Controls](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535)

<div class="topic-metadata">

**Author:** [@Boris\_Bek](https://discourse.threejs.org/u/Boris_Bek)\
**Replies:** 6\
**Last updated:** [March 7, 2024, 5:56pm UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535 "2024-03-07T17:56:38Z")

</div>

Hello, People I am trying to get model angle degree from 0 to 360 is there any way to do that, I am using Transform Controls and when I rotate model I want to get angle from 0 to 360 I am struggling because of Euler g…

---

## [Three-onlymath.min.js](https://discourse.threejs.org/t/three-onlymath-min-js/62101)

<div class="topic-metadata">

**Author:** [@Morten](https://discourse.threejs.org/u/Morten)\
**Replies:** 5\
**Last updated:** [February 29, 2024, 2:45pm UTC](https://discourse.threejs.org/t/three-onlymath-min-js/62101 "2024-02-29T14:45:20Z")

</div>

I have a file from a project I got from somebody else called three-onlymath.min.js. It’s only 72kb which is perfect. How do I obtain the latest version of this file? On github I can only find three.module.min.js which …

---

## [How to reset matrix?](https://discourse.threejs.org/t/how-to-reset-matrix/36939)

<div class="topic-metadata">

**Author:** [@sonygod](https://discourse.threejs.org/u/sonygod)\
**Replies:** 3\
**Last updated:** [February 14, 2024, 11:57am UTC](https://discourse.threejs.org/t/how-to-reset-matrix/36939 "2024-02-14T11:57:01Z")

</div>

how to reset matrix? like mesh.postion.set(0,0,0); mesh.rotate.set(0,0,0); mesh.scale.set(1,1,1); and eq mesh.matrix.xxxxxxx?

---

## [Getting incorrect Euclidean distance from intersections points](https://discourse.threejs.org/t/getting-incorrect-euclidean-distance-from-intersections-points/60998)

<div class="topic-metadata">

**Author:** [@husnaindev](https://discourse.threejs.org/u/husnaindev)\
**Replies:** 9\
**Last updated:** [February 6, 2024, 12:59am UTC](https://discourse.threejs.org/t/getting-incorrect-euclidean-distance-from-intersections-points/60998 "2024-02-06T00:59:37Z")

</div>

I’m new to Threejs trying to calculate euclidean distance from intersection points you can my code what should i do to get corrrect distance? function setPointOfIntersection(line, planarSrf, pos) { const intersect…

---

## [How can I apply a transformation to the position attribute values in a mesh?](https://discourse.threejs.org/t/how-can-i-apply-a-transformation-to-the-position-attribute-values-in-a-mesh/60421)

<div class="topic-metadata">

**Author:** [@leo2](https://discourse.threejs.org/u/leo2)\
**Replies:** 2\
**Last updated:** [January 17, 2024, 2:42pm UTC](https://discourse.threejs.org/t/how-can-i-apply-a-transformation-to-the-position-attribute-values-in-a-mesh/60421 "2024-01-17T14:42:09Z")

</div>

I have a mesh that is loaded from an stl file and displayed in a scene. I have to do calculations using the vertices of this mesh in another coordinate space. I need to apply a transformation to those vertices. I clon…

[Next page](https://discourse.threejs.org/tag/math/431.md?match_all_tags=true&page=1&tags%5B%5D=math)
