Light
Represents a light that shines in the modeling space.
Inheritance Hierarchy
System.Object
Rhino.Runtime.CommonObject
Rhino.Geometry.GeometryBase
Rhino.Geometry.Light
Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
[SerializableAttribute]public class Light : GeometryBase
The Light type exposes the following members.
Constructors
Name
Description
Public Method
Light.
Initializes a new light.
Protected Method
Light(SerializationInfo, StreamingContext)
Protected constructor used in serialization.
Properties
Name
Description
Public Property
Ambient
Gets or sets the ambient color.
Public Property
AttenuationType
Get the type of attenuation for this light.
Public Property
AttenuationVector
Gets or Sets the attenuation vector.
Public Property
CoordinateSystem
Gets a value, determined by LightStyle, that explains whether the camera directions are relative to World or Camera spaces.
Public Property
Code Example
Diffuse
Gets or sets the diffuse color.
Public Property
Direction
Gets or sets the vector direction of the camera.
Public Property
Disposed
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
(Inherited from CommonObject.)
Public Property
HasBrepForm
Returns true if the Brep.TryConvertBrep function will be successful for this object
(Inherited from GeometryBase.)
Public Property
HasUserData
Gets true if this class has any custom information attached to it through UserData.
(Inherited from CommonObject.)
Public Property
HotSpot
The hot spot setting runs from 0.0 to 1.0 and is used to provides a linear interface for controlling the focus or concentration of a spotlight. A hot spot setting of 0.0 corresponds to a spot exponent of 128. A hot spot setting of 1.0 corresponds to a spot exponent of 0.0.
Public Property
Id
Gets the ID of this light.
Public Property
Intensity
Gets or sets the light intensity.
Public Property
IsDeformable
true if object can be accurately modified with “squishy” transformations like projections, shears, and non-uniform scaling.
(Inherited from GeometryBase.)
Public Property
IsDirectionalLight
Gets a value indicating whether the light style is
LightStyle
CameraDirectional or WorldDirectional.Public Property
IsDocumentControlled
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to “IsReadOnly” will throw a NotSupportedException.
(Inherited from GeometryBase.)
Public Property
IsEnabled
Gets or sets a value that defines if the light is turned on (true) or off (false).
Public Property
IsLinearLight
Gets a value indicating whether the light style is
LightStyle
WorldLinear.Public Property
IsPointLight
Gets a value indicating whether the light style is
LightStyle
CameraPoint or WorldPoint.Public Property
IsRectangularLight
Gets a value indicating whether the light style is
LightStyle
WorldRectangular.Public Property
IsSpotLight
Gets a value indicating whether the light style is
LightStyle
CameraSpot or WorldSpot.Public Property
IsSunLight
Gets a value indicating whether this object is a Sun light.
Public Property
IsValid
Tests an object to see if it is valid.
(Inherited from CommonObject.)
Public Property
Length
Gets or sets the height in linear and rectangular lights.
(ignored for non-linear/rectangular lights.)
Public Property
LightStyle
Gets or sets a light style on this camera.
Public Property
Location
Gets or sets the light or 3D position or location.
Public Property
Name
Gets or sets the spot light name.
Public Property
ObjectType
Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on.
(Inherited from GeometryBase.)
Public Property
PerpendicularDirection
Gets a perpendicular vector to the camera direction.
Public Property
PowerCandela
Gets or sets the light power in candelas (cd).
Public Property
PowerLumens
Gets or sets the light power in lumens (lm).
Public Property
PowerWatts
Gets or sets the light power in watts (W).
Public Property
ShadowIntensity
Gets or sets the shadow intensity for the light.
Public Property
Specular
Gets or sets the specular color.
Public Property
SpotAngleRadians
Gets or sets the spot angle in radians.
Ignored for non-spot lights.
angle = 0 to pi/2 (0 to 90 degrees).
Public Property
SpotExponent
The spot exponent varies from 0.0 to 128.0 and provides an exponential interface for controlling the focus or concentration of a spotlight (like the OpenGL GL_SPOT_EXPONENT parameter). The spot exponent and hot spot parameters are linked; changing one will change the other. A hot spot setting of 0.0 corresponds to a spot exponent of 128. A hot spot setting of 1.0 corresponds to a spot exponent of 0.0.
Public Property
SpotLightShadowIntensity
Obsolete.
Gets or sets the spot light shadow intensity.
(ignored for non-spot lights.)
Public Property
UserData
List of custom information that is attached to this class.
(Inherited from CommonObject.)
Public Property
UserDictionary
Dictionary of custom information attached to this class. The dictionary is actually user data provided as an easy to use shareable set of information.
(Inherited from CommonObject.)
Public Property
UserStringCount
Gets the amount of user strings.
(Inherited from GeometryBase.)
Public Property
Width
Gets or sets the width in linear and rectangular lights.
(ignored for non-linear/rectangular lights.)
Methods
Name
Description
Public Method
ComponentIndex
If this piece of geometry is a component in something larger, like a BrepEdge in a Brep, then this function returns the component index.
(Inherited from GeometryBase.)
Protected Method
ConstructConstObject
Assigns a parent object and a sub-object index to this.
(Inherited from CommonObject.)
Public Method
Static Member
CreateSunLight(Sun)
Constructs a light which simulates a Sun.
Public Method
Static Member
CreateSunLight(Double, Double, Double)
Constructs a light that represents the Sun.
Public Method
Static Member
CreateSunLight(Double, DateTime, Double, Double)
Constructs a light which simulates the Sun based on a given time and location on Earth.
Public Method
DataCRC
Returns a CRC calculated from the information that defines the object. This CRC can be used as a quick way to see if two objects are not identical.
(Inherited from GeometryBase.)
Public Method
DeleteAllUserStrings
(Inherited from GeometryBase.)
Public Method
DeleteUserString
(Inherited from GeometryBase.)
Public Method
Dispose.
Actively reclaims unmanaged resources that this instance uses.
(Inherited from CommonObject.)
Protected Method
Dispose(Boolean)
Overridden in order to destroy local display cache information
(Inherited from GeometryBase.)
Public Method
Duplicate
Constructs a deep (full) copy of this object.
(Inherited from GeometryBase.)
Public Method
DuplicateShallow
Constructs a light copy of this object. By “light”, it is meant that the same underlying data is used until something is done to attempt to change it. For example, you could have a shallow copy of a very heavy mesh object and the same underlying data will be used when doing things like inspecting the number of faces on the mesh. If you modify the location of one of the mesh vertices, the shallow copy will create a full duplicate of the underlying mesh data and the shallow copy will become a deep copy.
(Inherited from GeometryBase.)
Public Method
EnsurePrivateCopy
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
(Inherited from CommonObject.)
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected Method
Finalize
Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().
(Inherited from CommonObject.)
Public Method
GetAttenuation
Gets the attenuation settings (ignored for “directional” and “ambient” lights).
attenuation = 1/(a0 + d*a1 + d^2*a2) where d = distance to light.
Public Method
Code Example
GetBoundingBox(Boolean)
Bounding box solver. Gets the world axis aligned bounding box for the geometry.
(Inherited from GeometryBase.)
Public Method
Code Example
GetBoundingBox(Plane)
Aligned Bounding box solver. Gets the plane aligned bounding box.
(Inherited from GeometryBase.)
Public Method
GetBoundingBox(Transform)
Aligned Bounding box solver. Gets the world axis aligned bounding box for the transformed geometry.
(Inherited from GeometryBase.)
Public Method
GetBoundingBox(Plane, Box.)
Aligned Bounding box solver. Gets the plane aligned bounding box.
(Inherited from GeometryBase.)
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public Method
GetObjectData
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
(Inherited from CommonObject.)
Public Method
GetSpotLightRadii
Gets the spot light radii.
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
GetUserString
Gets user string from this geometry.
(Inherited from GeometryBase.)
Public Method
GetUserStrings
Gets a copy of all (user key string, user value string) pairs attached to this geometry.
(Inherited from GeometryBase.)
Public Method
IsValidWithLog
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
(Inherited from CommonObject.)
Public Method
MakeDeformable
If possible, converts the object into a form that can be accurately modified with “squishy” transformations like projections, shears, an non-uniform scaling.
(Inherited from GeometryBase.)
Protected Method
MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public Method
MemoryEstimate
Computes an estimate of the number of bytes that this object is using in memory.
(Inherited from GeometryBase.)
Protected Method
NonConstOperation
Destroy cache handle
(Inherited from GeometryBase.)
Protected Method
OnSwitchToNonConst
Is called when a non-constant operation occurs.
(Inherited from GeometryBase.)
Public Method
Rotate
Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule).
(Inherited from GeometryBase.)
Public Method
Scale
Scales the object by the specified factor. The scale is centered at the origin.
(Inherited from GeometryBase.)
Public Method
SetAttenuation
Sets the attenuation settings (ignored for “directional” and “ambient” lights).
attenuation = 1/(a0 + d*a1 + d^2*a2) where d = distance to light.
Public Method
SetUserString
Attach a user string (key,value combination) to this geometry.
(Inherited from GeometryBase.)
Public Method
ToJSON
Create a JSON string representation of this object
(Inherited from CommonObject.)
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object.)
Public Method
Transform
Transforms the geometry. If the input Transform has a SimilarityType of OrientationReversing, you may want to consider flipping the transformed geometry after calling this function when it makes sense. For example, you may want to call Flip() on a Brep after transforming it.
(Inherited from GeometryBase.)
Public Method
Translate(Vector3d)
Translates the object along the specified vector.
(Inherited from GeometryBase.)
Public Method
Translate(Double, Double, Double)
Translates the object along the specified vector.
(Inherited from GeometryBase.)
Fields
Name
Description
Public Field
Static Member
ConstantAttenuationVector
Vector denoting a constant light attenuation.
Public Field
Static Member
InverseSquaredAttenuationVector
Vector denoting an inverse squared light attenuation.
Public Field
Static Member
LinearAttenuationVector
Vector denoting a linear light attenuation.