/// <summary>
    /// Constructs a light that represents the Sun.
    /// </summary>
    /// <param name="northAngleDegrees">The angle of North in degrees. North is the angle between positive World Y axis and model North, as measured on World XY plane.</param>
    /// <param name="azimuthDegrees">The Azimut angle value in degrees. Azimuth is the compass angle from North.</param>
    /// <param name="altitudeDegrees">The Altitude angle in degrees. Altitude is the angle above the ground plane.</param>
    /// <returns>A new sun light.</returns>
    /// <exception cref="Rhino.Runtime.RdkNotLoadedException">If the RDK is not loaded.</exception>
    public static Light CreateSunLight(double northAngleDegrees, double azimuthDegrees, double altitudeDegrees)
    {
      Rhino.Runtime.HostUtils.CheckForRdk(true, true);

      IntPtr pSun = UnsafeNativeMethods.Rdk_SunNew();
      IntPtr pSunInterface = UnsafeNativeMethods.Rdk_SunInterface(pSun);
      UnsafeNativeMethods.Rdk_Sun_SetNorth(pSunInterface, northAngleDegrees);
      UnsafeNativeMethods.Rdk_Sun_SetAzimuthAltitude(pSunInterface, azimuthDegrees, altitudeDegrees);

      Light rc = new Light();
      IntPtr pLight = rc.NonConstPointer();
      UnsafeNativeMethods.Rdk_Sun_Light(pSunInterface, pLight);
      UnsafeNativeMethods.Rdk_SunDelete(pSun);
      return rc;
    }
Exemple #2
0
        /// <summary>
        /// Constructs a light that represents the Sun.
        /// </summary>
        /// <param name="northAngleDegrees">The angle of North in degrees. North is the angle between positive World Y axis and model North, as measured on World XY plane.</param>
        /// <param name="azimuthDegrees">The Azimut angle value in degrees. Azimuth is the compass angle from North.</param>
        /// <param name="altitudeDegrees">The Altitude angle in degrees. Altitude is the angle above the ground plane.</param>
        /// <returns>A new sun light.</returns>
        /// <exception cref="Rhino.Runtime.RdkNotLoadedException">If the RDK is not loaded.</exception>
        public static Light CreateSunLight(double northAngleDegrees, double azimuthDegrees, double altitudeDegrees)
        {
            Rhino.Runtime.HostUtils.CheckForRdk(true, true);

            IntPtr pSun          = UnsafeNativeMethods.Rdk_SunNew();
            IntPtr pSunInterface = UnsafeNativeMethods.Rdk_SunInterface(pSun);

            UnsafeNativeMethods.Rdk_Sun_SetNorth(pSunInterface, northAngleDegrees);
            UnsafeNativeMethods.Rdk_Sun_SetAzimuthAltitude(pSunInterface, azimuthDegrees, altitudeDegrees);

            Light  rc     = new Light();
            IntPtr pLight = rc.NonConstPointer();

            UnsafeNativeMethods.Rdk_Sun_Light(pSunInterface, pLight);
            UnsafeNativeMethods.Rdk_SunDelete(pSun);
            return(rc);
        }
    /// <summary>
    /// Constructs a light which simulates the Sun based on a given time and location on Earth.
    /// </summary>
    /// <param name="northAngleDegrees">The angle of North in degrees. North is the angle between positive World Y axis and model North, as measured on World XY plane.</param>
    /// <param name="when">The time of the measurement. The Kind property of DateTime specifies whether this is in local or universal time.
    /// <para>Local and Undefined <see cref="DateTimeKind">daytime kinds</see> in this argument are considered local.</para></param>
    /// <param name="latitudeDegrees">The latitude, in degrees, of the location on Earth.</param>
    /// <param name="longitudeDegrees">The longitude, in degrees, of the location on Earth.</param>
    /// <returns>A newly constructed light object.</returns>
    /// <exception cref="Rhino.Runtime.RdkNotLoadedException">If the RDK is not loaded.</exception>
    public static Light CreateSunLight(double northAngleDegrees, DateTime when, double latitudeDegrees, double longitudeDegrees)
    {
      Rhino.Runtime.HostUtils.CheckForRdk(true, true);

      IntPtr pSun = UnsafeNativeMethods.Rdk_SunNew();
      IntPtr pSunInterface = UnsafeNativeMethods.Rdk_SunInterface(pSun);
      UnsafeNativeMethods.Rdk_Sun_SetNorth(pSunInterface, northAngleDegrees);
      UnsafeNativeMethods.Rdk_Sun_SetLatitudeLongitude(pSunInterface, latitudeDegrees, longitudeDegrees);

      bool local = (when.Kind == DateTimeKind.Local || when.Kind == DateTimeKind.Unspecified);
      UnsafeNativeMethods.Rdk_Sun_SetDateTime(pSunInterface, local, when.Year, when.Month, when.Day, when.Hour, when.Minute, when.Second);
      Light rc = new Light();
      IntPtr pLight = rc.NonConstPointer();
      UnsafeNativeMethods.Rdk_Sun_Light(pSunInterface, pLight);
      UnsafeNativeMethods.Rdk_SunDelete(pSun);
      return rc;
    }
Exemple #4
0
        /// <summary>
        /// Constructs a light which simulates the Sun based on a given time and location on Earth.
        /// </summary>
        /// <param name="northAngleDegrees">The angle of North in degrees. North is the angle between positive World Y axis and model North, as measured on World XY plane.</param>
        /// <param name="when">The time of the measurement. The Kind property of DateTime specifies whether this is in local or universal time.
        /// <para>Local and Undefined <see cref="DateTimeKind">daytime kinds</see> in this argument are considered local.</para></param>
        /// <param name="latitudeDegrees">The latitude, in degrees, of the location on Earth.</param>
        /// <param name="longitudeDegrees">The longitude, in degrees, of the location on Earth.</param>
        /// <returns>A newly constructed light object.</returns>
        /// <exception cref="Rhino.Runtime.RdkNotLoadedException">If the RDK is not loaded.</exception>
        public static Light CreateSunLight(double northAngleDegrees, DateTime when, double latitudeDegrees, double longitudeDegrees)
        {
            Rhino.Runtime.HostUtils.CheckForRdk(true, true);

            IntPtr pSun          = UnsafeNativeMethods.Rdk_SunNew();
            IntPtr pSunInterface = UnsafeNativeMethods.Rdk_SunInterface(pSun);

            UnsafeNativeMethods.Rdk_Sun_SetNorth(pSunInterface, northAngleDegrees);
            UnsafeNativeMethods.Rdk_Sun_SetLatitudeLongitude(pSunInterface, latitudeDegrees, longitudeDegrees);

            bool local = (when.Kind == DateTimeKind.Local || when.Kind == DateTimeKind.Unspecified);

            UnsafeNativeMethods.Rdk_Sun_SetDateTime(pSunInterface, local, when.Year, when.Month, when.Day, when.Hour, when.Minute, when.Second);
            Light  rc     = new Light();
            IntPtr pLight = rc.NonConstPointer();

            UnsafeNativeMethods.Rdk_Sun_Light(pSunInterface, pLight);
            UnsafeNativeMethods.Rdk_SunDelete(pSun);
            return(rc);
        }