MaplySun

Objective-C

@interface MaplySun : NSObject

Swift

class MaplySun : NSObject

Utility for calculating sun position and shading info.

This is a utility class that figures out where the sun is at a given date and provides positional information for lighting calculations.

  • Initialize with a date.

    Initialize with the given date. The sun position will correspond to that.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDate:(NSDate *_Nonnull)date;

    Swift

    init(date: Date)
  • Return the vector corresponding to the sun location from the earth.

    Declaration

    Objective-C

    - (MaplyCoordinate3d)getDirection;

    Swift

    func getDirection() -> MaplyCoordinate3d
  • Makes up a light that corresponds to the sun’s location at a given time

    Declaration

    Objective-C

    - (nonnull MaplyLight *)makeLight;

    Swift

    func makeLight() -> MaplyLight
  • Returns the location above the globe in lon/lat. Yay geocentrism!

    Declaration

    Objective-C

    - (MaplyCoordinate)asPosition;

    Swift

    func asPosition() -> MaplyCoordinate