Trig problems on orthogonal projection code

Question:
Trig problems causing wildly incorrect projection of the vertices of a cube


Repl link:
https://replit.com/@imcute-aaaa/bond-physics#script.js

function project3D(v, w, p, y) {
	v=v.copy().sub(w);
	let sy=Math.sin(y),cy=Math.cos(y),sp=Math.sin(p),cp=Math.cos(p);
	return new Vector(
		v.x*cy+v.z*sy,
		v.y*cp+sp*(v.z*cy-v.x*sy),
		cp*(v.z*cy-v.x*sy)-v.y*sp
	);
}

:frowning: noone wanting to help?

Much more context is required here, and also much more meaningful variables names, in order for anyone to be ale to help.

1 Like

WAT?Isn’t it meaningful enough?

Normally, we use whole words as variable names to make our codes easier to read. Also you cannot assume that just because no one helps no one wants to help you. I do not have the knowledge required to solve your problem, hence I do not help you. It doesn’t mean that I’m not willing to help you, but rather that any help I offer will be useless.

3 Likes