Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void calculateNormal(GL gl, double height, String windPart) {
- Vector3D vertA;
- Vector3D vertB;
- Vector3D vertC;
- Vector3D normal;
- Point2D p1 = (Point2D)(pts2d.get(0));
- Point2D p2 = (Point2D)(pts2d.get(1));
- if (windPart.equals("bot")) {
- vertA = new Vector3D(p1.x, extra[0], p1.y);
- vertB = new Vector3D(p2.x, extra[0], p2.y);
- vertC = new Vector3D(p2.x, extra[0] + height *1/3, p2.y);
- }else{
- vertA = new Vector3D(p1.x, extra[1] - height *1/3, p1.y);
- vertB = new Vector3D(p2.x, extra[1] - height *1/3, p2.y);
- vertC = new Vector3D(p2.x, extra[1], p2.y);
- }
- vertB = vertB.subtract(vertA);
- vertC = vertC.subtract(vertA);
- normal = vertB.cross(vertC);
- normal.normalize();
- gl.glNormal3d(normal.x, normal.y, normal.z);
- }
Add Comment
Please, Sign In to add comment