Skip to content

Commit ef70ac4

Browse files
committed
Fix plane generator for axis-aligned planes
1 parent dcaf03a commit ef70ac4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

js/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44911,6 +44911,9 @@ function cube(size) {
4491144911
function plane(p, n, size) {
4491244912
n = n.normalize().negate();
4491344913
var m = new THREE.Vector3(0, 0, 1);
44914+
if (Math.abs(m.dot(n)) < 0.01) {
44915+
m = new THREE.Vector3(1, 0, 0);
44916+
}
4491444917

4491544918
var a = n.clone().cross(m);
4491644919
var b = a.clone().cross(n);

src/csg.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ function cube(size) {
143143
function plane(p, n, size) {
144144
n = n.normalize().negate();
145145
let m = new THREE.Vector3(0, 0, 1);
146+
if (Math.abs(m.dot(n)) < 0.01) {
147+
m = new THREE.Vector3(1,0,0);
148+
}
146149

147150
let a = n.clone().cross(m);
148151
let b = a.clone().cross(n);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy