From 6600d22461ccc1cb602f238a9ffa83cf07dd830e Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 01 Jul 2019 18:04:02 -0400 Subject: [PATCH] Get icons 256x256 --- Torus.java | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Torus.java b/Torus.java index 8f85353..9e5fb59 100644 --- a/Torus.java +++ b/Torus.java @@ -2,6 +2,8 @@ class Torus extends Biparam implements java.io.Serializable { + static final long serialVersionUID = -7637054329820073252L; + Torus() { inPnt = new cVector(); @@ -61,16 +63,25 @@ if (v == 1) v = 0; - double uAng = LA.toRadians((1-u) * 360); - double vAng = LA.toRadians(v * 360); - double x = (double)Math.cos(uAng) * (major + (double)Math.cos(vAng) * minor); - double y = (double)Math.sin(vAng) * minor; + double uAng = u * 2 * Math.PI; + double vAng = v * 2 * Math.PI; + double cosua = Math.cos(uAng); + double sinua = Math.sin(uAng); + double cosva = Math.cos(vAng); + double sinva = Math.sin(vAng); + + double radius = (major + cosva * minor); + double x = cosua * radius; + double y = sinva * minor; if (Math.abs(y) < 1E-10) y = 0; // hashtable issue - double z = (double)Math.sin(uAng) * (major + (double)Math.cos(vAng) * minor); + + double z = sinua * radius; cVector tPos = LA.newVector(x, y, z); - double xx = (double)(Math.cos(uAng) * Math.cos(vAng)) * minor; - double zz = (double)(Math.sin(uAng) * Math.cos(vAng)) * minor; + + double xx = cosua * cosva * minor; + double zz = sinua * cosva * minor; + cVector tNorm = LA.newVector(xx, y, zz); Vertex temp = new Vertex(tPos); //temp.pos = tPos; // useless new @@ -167,13 +178,13 @@ return true; } - void doEditDrag(ClickInfo info) + void doEditDrag(ClickInfo info, boolean opposite) { if (hitSomething == 0) return; if (hitSomething == 1) { - super.doEditDrag(info); + super.doEditDrag(info, opposite); return; } double deltaR = info.x - startX; -- Gitblit v1.6.2