Codota Logo
SunInfo
Code IndexAdd Codota to your IDE (free)

How to use
SunInfo
in
org.deegree.commons.utils

Best Java code snippets using org.deegree.commons.utils.SunInfo (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: deegree/deegree3

/**
 * @param year
 * @param month
 * @param day
 * @param hour
 * @param minute
 */
public SunInfo( int year, int month, int day, int hour, int minute ) {
  this.year = year;
  this.month = month;
  if ( month <= 0 || month > 12 ) {
    this.month = 1;
  }
  this.day = day;
  if ( day <= 0 || day > 32 ) {
    this.day = 1;
  }
  this.hour = hour;
  if ( hour < 0 || hour >= 24 ) {
    this.hour = 0;
  }
  this.minute = minute;
  if ( minute < 0 || minute >= 60 ) {
    this.minute = 0;
  }
  daysSinceVernalEquinox = getDaySinceVernalEquinox();
}
origin: deegree/deegree3

/**
 * Get the euclidean position of the sun.
 * 
 * @param latitude
 * @return the euclidean position of the sun.
 */
public float[] getEucledianPosition( double latitude ) {
  double vPos = getVerticalSunposition( latitude );
  double hPos = getHorizontalSunPosition();
  return new float[] { (float) Math.sin( hPos ), (float) Math.sin( vPos ), (float) -Math.abs( Math.cos( hPos ) ) };
}
origin: deegree/deegree3

SunInfo pos = new SunInfo( cal );
light_position = pos.getEucledianPosition( 51.7 );
Vectors3f.scale( -1, light_position );
float[] ambientAndDiffuse = pos.calculateSunlight( 51.7 );
float intens = pos.calcSunlightIntensity( ambientAndDiffuse, 0.5f );
origin: deegree/deegree3

private void init( GL gl ) {
  float[] cc = JOGLUtils.convertColorFloats( request.getBackgroundColor() );
  gl.glClearColor( cc[0], cc[1], cc[2], 0.0f );
  SunInfo pos = request.getSceneParameters().getSunPosition();
  float[] light_position = pos.getEucledianPosition( sceneLatitude );
  Vectors3f.scale( -1, light_position );
  float[] ambientAndDiffuse = pos.calculateSunlight( sceneLatitude );
  // float intens = pos.calcSunlightIntensity( ambientAndDiffuse, 0.5f );
  gl.glLightfv( GL.GL_LIGHT0, GL.GL_POSITION, new float[] { light_position[0], light_position[1],
                               light_position[2], 0 }, 0 );
  gl.glLightfv( GL.GL_LIGHT0, GL.GL_AMBIENT, new float[] { ambientAndDiffuse[0], ambientAndDiffuse[1],
                              ambientAndDiffuse[2], 1 }, 0 );
  gl.glMaterialfv( GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] { ambientAndDiffuse[0], ambientAndDiffuse[1],
                                    ambientAndDiffuse[2], 1 }, 0 );
  gl.glLightfv( GL.GL_LIGHT0, GL.GL_DIFFUSE, new float[] { ambientAndDiffuse[0], ambientAndDiffuse[1],
                              ambientAndDiffuse[2], 1 }, 0 );
}
origin: deegree/deegree3

SunInfo pos = new SunInfo( cal );
origin: deegree/deegree3

/**
 * This method calculates the color of the sunlight for the current time and the given latitude. This method is
 * taken from deegree2, the values are undocumented.
 * 
 * @param latitude
 * 
 * @return a the color of the sunlight for the given latitude.
 */
public float[] calculateSunlight( double latitude ) {
  double vDir = getVerticalSunposition( latitude );
  // rb: 7.25 is?
  float c = 7.25f * ( (float) Math.sin( vDir ) );
  float[] color = new float[3];
  color[0] = min( 1, ( ( BASE_LIGHT_INTENSITY + ( c / 16f ) + 0.05f ) * 0.6f ) );
  color[1] = min( 1, ( ( BASE_LIGHT_INTENSITY + ( c / 18.5f ) + 0.05f ) * 0.6f ) );
  color[2] = min( 1, ( ( BASE_LIGHT_INTENSITY + ( c / 17f ) + 0.05f ) * 0.55f ) );
  return color;
}
origin: deegree/deegree3

/**
 * calculates the solar altitude for given latitude, year, month, date, hour and minute
 * 
 * @param latitude
 *            latitude of the the viewers position
 * @return the solar altitude in radians for the given latitude
 */
public double getVerticalSunposition( double latitude ) {
  // Hour Angle (H),
  // Solar Declination (D),
  // Latitude (L)
  // solar altitude (A).
  // sin(A) = sin(D)*sin(L) + cos(D)*cos(L)*cos(H)
  double rad23_5 = 0.41015237421866745057706;
  // double days = getDaySinceVernalEquinox( year, month, date );
  double sinD = Math.sin( rad23_5 ) * Math.sin( Math.toRadians( daysSinceVernalEquinox * 360.0 / 365.0 ) );
  double cosD = Math.cos( Math.asin( sinD ) );
  // the sun hour angle is zero when the object is on the meridian
  double h = getHorizontalSunPosition() - Math.toRadians( 180 );
  double radL = Math.toRadians( latitude );
  double sinA = sinD * Math.sin( radL ) + cosD * Math.cos( radL ) * Math.cos( h );
  return Math.asin( sinA );
}
origin: deegree/deegree3

/**
 * Constructs a sunposition at the current (local) time
 */
public SunInfo() {
  GregorianCalendar calendar = new GregorianCalendar();
  this.year = calendar.get( Calendar.YEAR );
  this.month = calendar.get( Calendar.MONTH ) + 1;
  this.day = calendar.get( Calendar.DAY_OF_MONTH );
  this.hour = calendar.get( Calendar.HOUR_OF_DAY );
  this.minute = calendar.get( Calendar.MINUTE );
  daysSinceVernalEquinox = getDaySinceVernalEquinox();
}
org.deegree.commons.utilsSunInfo

Javadoc

The SunInfo supplies methods for the calculation of the sun position at a given time and latitude. The color of the sunlight may be requested as well.

Most used methods

  • <init>
    Constructs a sunposition with the given Calendar
  • calculateSunlight
    This method calculates the color of the sunlight for the current time and the given latitude. This m
  • getEucledianPosition
    Get the euclidean position of the sun.
  • calcSunlightIntensity
  • getDaySinceVernalEquinox
    caluculates for a given date the number of days since the last vernal(spring) equinox. (leap years a
  • getHorizontalSunPosition
    calculates the horizontal angle of the sun depending only on hour and minute!
  • getVerticalSunposition
    calculates the solar altitude for given latitude, year, month, date, hour and minute

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • JButton (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now