Class: DefRefraction

algeobra~DefRefraction(params)

Definition of a vector refracted along a normal

Constructor

new DefRefraction(params)

Default values
Parameters:
Name Type Description
params Object
Properties
Name Type Description
eta Number Ratio of the index of refractions of the two media
normalize Boolean Whether the vector should be normalized
Source:

Methods

compute(createInfo) → {Object}

Computes the refraction
Parameters:
Name Type Description
createInfo CreateInfo The creation info
Source:
Returns:
The refraction vector with type TYPE_VECTOR
Type
Object

(static) fromVectorNormal(params) → {CreateInfo}

Computes the refraction of a vector along a normal.
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
v Number | Object Either the index or value of a TYPE_VECTOR. The vector to be refracted
n Number | Object Either the index or value of a TYPE_VECTOR. The normal
ref Number | Object <optional>
Either the index or value of a TYPE_POINT. The reference point
eta Number | Object <optional>
Either the index or value of a TYPE_NUMBER. The ratio of refractive indices. Will be inverted, if the incoming direction points into the same half space as the normal
normalize Number | Object <optional>
Either the index or value of a TYPE_BOOLEAN. Whether the vector should be normalized
Source:
Returns:
The creation info
Type
CreateInfo

(static) refractVector(i, n, eta) → {Object|null}

Computes the refraction of an incident diretion I along a vector N
Parameters:
Name Type Description
i Object The incident direction
n Object The normal
eta Number The ratio of refractive indices. Will be inverted, if the incoming direction points into the same half space as the normal
Source:
Returns:
The refracted vector. In case of total internal reflection, null will be returned
Type
Object | null