Project

General

Profile

« Previous | Next » 

Revision cbca11a3

Added by Leszek Koltunski almost 6 years ago

Progress with the Earth app.

View differences:

src/main/java/org/distorted/library/mesh/MeshSphere.java
31 31
public class MeshSphere extends MeshBase
32 32
  {
33 33
  private static final int NUMFACES = 16;
34
  private static final double sqrt2 = Math.sqrt(2.0);
35 34
  private static final double P = Math.PI;
36 35

  
37 36
  // An array of 16 entries, each describing a single face of the solid in an (admittedly) weird
......
180 179
    double sinLAT = Math.sin(latitude);
181 180
    double cosLAT = Math.cos(latitude);
182 181

  
183
    float x = (float)(cosLAT*sinLON / sqrt2);
184
    float y = (float)(sinLAT        / sqrt2);
185
    float z = (float)(cosLAT*cosLON / sqrt2);
182
    float x = (float)(cosLAT*sinLON / 2.0f);
183
    float y = (float)(sinLAT        / 2.0f);
184
    float z = (float)(cosLAT*cosLON / 2.0f);
186 185

  
187 186
    double texX = 0.5 + longitude/(2*P);
188 187
    if( texX>=1.0 ) texX-=1.0;

Also available in: Unified diff