C# Class BRDFSlices.DisplayForm

Show file Open project: Patapom/GodComplex Class Usage Examples

Protected Properties

Property Type Description
m_BRDF BRDFSlices.Vector3[
m_Intersections ].double[
m_Pen Pen
m_Slice Bitmap

Public Methods

Method Description
DisplayForm ( Vector3 _BRDF ) : System
LoadBRDF ( FileInfo _BRDFFile ) : BRDFSlices.Vector3[

Loads a MERL BRDF file

LookupBRDF ( Vector3 _BRDF, double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut, Vector3 &_Result ) : void

Given a pair of incoming/outgoing angles, look up the BRDF.

LookupBRDFTrilinear ( Vector3 _BRDF, double _ThetaHalf, double _ThetaDiff, double _PhiDiff, Vector3 &_Result ) : void
PhiDiff_index ( double _PhiDiff, double &_Interpolant ) : int
ThetaDiff_index ( double _ThetaDiff, double &_Interpolant ) : int
ThetaHalf_index ( double _ThetaHalf, double &_Interpolant ) : int
half_diff_coords_to_std_coords ( double _ThetaHalf, double _PhiHalf, double _ThetaDiff, double _PhiDiff, Vector3 &_In, Vector3 &_Out ) : void
half_diff_coords_to_std_coords ( double _ThetaHalf, double _PhiHalf, double _ThetaDiff, double _PhiDiff, double &_ThetaIn, double &_PhiIn, double &_ThetaOut, double &_PhiOut ) : void
std_coords_to_half_diff_coords ( double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut, double &_ThetaHalf, double &_PhiHalf, double &_ThetaDiff, double &_PhiDiff ) : void

Protected Methods

Method Description
BuildScaleTable ( ) : void
ComputeScaleFactor ( double _ThetaH, double _ThetaD, double _PhiD ) : double
Dispose ( bool disposing ) : void

Clean up any resources being used.

LoadBRDFBisou ( FileInfo _BRDFFile ) : double[][]

Loads a MERL BRDF file

LoadScaleTable ( ) : void
Redraw ( ) : void
SaveAllSlices ( ) : void
SaveAllSlices_BUGGED ( ) : void
SolveNewton ( double a, double b, int &_IterationsCount ) : double

Numerically computes the intersection of a straight line with a strange curve we know the equation of... We're using the http://en.wikipedia.org/wiki/Newton's_method The computation is occurring in [ThetaH,ThetaD] space: ^ ThetaD | PI/2 +----------/-----+ ThetaH PI/2 We're looking for intersection point o given 2 values: the slope of the straight line and PhiD that guides the curvature of the strange curve C(y) The position of a point P on the line is given by P(x)=[x,slope.x] (we know the slope) we find o so that o = P(x) = C(y) So we can write: x = atan( tan(PI/2 - y) / cos(PhiD)) y = slope.x Replacing: x = atan( tan(PI/2 - slope.x) / cos(PhiD) ) Tanning: tan(x) = tan(PI/2 - slope.x) / cos(PhiD) Or: tan(x).tan(slope.x) = 1 / cos(PhiD) We know "slope" and "PhiD", we need solve to find x which is the ThetaH at which the intersection occurs...

WarpSlice ( int _ThetaHIndex, int _ThetaDIndex, double _Warp, Vector3 &_Result ) : void
WarpSlice_Compress ( int _ThetaHIndex, int _ThetaDIndex, double _Warp, Vector3 &_Result ) : void

Private Methods

Method Description
InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

buttonRebuild_Click ( object sender, EventArgs e ) : void
checkBoxDifferences_CheckedChanged ( object sender, EventArgs e ) : void
checkBoxShowIsolines_CheckedChanged ( object sender, EventArgs e ) : void
checkBoxUseWarping_CheckedChanged ( object sender, EventArgs e ) : void
floatTrackbarControlExposure_ValueChanged ( Nuaj _Sender, float _fFormerValue ) : void
floatTrackbarControlGamma_ValueChanged ( Nuaj _Sender, float _fFormerValue ) : void
floatTrackbarControlScaleFactor_ValueChanged ( Nuaj _Sender, float _fFormerValue ) : void
floatTrackbarControlWarpFactor_ValueChanged ( Nuaj _Sender, float _fFormerValue ) : void
integerTrackbarControlPhiD_ValueChanged ( Nuaj _Sender, int _FormerValue ) : void

Method Details

BuildScaleTable() protected method

protected BuildScaleTable ( ) : void
return void

ComputeScaleFactor() protected method

protected ComputeScaleFactor ( double _ThetaH, double _ThetaD, double _PhiD ) : double
_ThetaH double
_ThetaD double
_PhiD double
return double

DisplayForm() public method

public DisplayForm ( Vector3 _BRDF ) : System
_BRDF Vector3
return System

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void

LoadBRDF() public static method

Loads a MERL BRDF file
public static LoadBRDF ( FileInfo _BRDFFile ) : BRDFSlices.Vector3[
_BRDFFile FileInfo
return BRDFSlices.Vector3[

LoadBRDFBisou() protected method

Loads a MERL BRDF file
protected LoadBRDFBisou ( FileInfo _BRDFFile ) : double[][]
_BRDFFile FileInfo
return double[][]

LoadScaleTable() protected method

protected LoadScaleTable ( ) : void
return void

LookupBRDF() public static method

Given a pair of incoming/outgoing angles, look up the BRDF.
public static LookupBRDF ( Vector3 _BRDF, double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut, Vector3 &_Result ) : void
_BRDF Vector3
_ThetaIn double
_PhiIn double
_ThetaOut double
_PhiOut double
_Result Vector3
return void

LookupBRDFTrilinear() public static method

public static LookupBRDFTrilinear ( Vector3 _BRDF, double _ThetaHalf, double _ThetaDiff, double _PhiDiff, Vector3 &_Result ) : void
_BRDF Vector3
_ThetaHalf double
_ThetaDiff double
_PhiDiff double
_Result Vector3
return void

PhiDiff_index() public static method

public static PhiDiff_index ( double _PhiDiff, double &_Interpolant ) : int
_PhiDiff double
_Interpolant double
return int

Redraw() protected method

protected Redraw ( ) : void
return void

SaveAllSlices() protected method

protected SaveAllSlices ( ) : void
return void

SaveAllSlices_BUGGED() protected method

protected SaveAllSlices_BUGGED ( ) : void
return void

SolveNewton() protected method

Numerically computes the intersection of a straight line with a strange curve we know the equation of... We're using the http://en.wikipedia.org/wiki/Newton's_method The computation is occurring in [ThetaH,ThetaD] space: ^ ThetaD | PI/2 +----------/-----+ ThetaH PI/2 We're looking for intersection point o given 2 values: the slope of the straight line and PhiD that guides the curvature of the strange curve C(y) The position of a point P on the line is given by P(x)=[x,slope.x] (we know the slope) we find o so that o = P(x) = C(y) So we can write: x = atan( tan(PI/2 - y) / cos(PhiD)) y = slope.x Replacing: x = atan( tan(PI/2 - slope.x) / cos(PhiD) ) Tanning: tan(x) = tan(PI/2 - slope.x) / cos(PhiD) Or: tan(x).tan(slope.x) = 1 / cos(PhiD) We know "slope" and "PhiD", we need solve to find x which is the ThetaH at which the intersection occurs...
protected SolveNewton ( double a, double b, int &_IterationsCount ) : double
a double
b double
_IterationsCount int
return double

ThetaDiff_index() public static method

public static ThetaDiff_index ( double _ThetaDiff, double &_Interpolant ) : int
_ThetaDiff double
_Interpolant double
return int

ThetaHalf_index() public static method

public static ThetaHalf_index ( double _ThetaHalf, double &_Interpolant ) : int
_ThetaHalf double
_Interpolant double
return int

WarpSlice() protected method

protected WarpSlice ( int _ThetaHIndex, int _ThetaDIndex, double _Warp, Vector3 &_Result ) : void
_ThetaHIndex int
_ThetaDIndex int
_Warp double
_Result Vector3
return void

WarpSlice_Compress() protected method

protected WarpSlice_Compress ( int _ThetaHIndex, int _ThetaDIndex, double _Warp, Vector3 &_Result ) : void
_ThetaHIndex int
_ThetaDIndex int
_Warp double
_Result Vector3
return void

half_diff_coords_to_std_coords() public static method

public static half_diff_coords_to_std_coords ( double _ThetaHalf, double _PhiHalf, double _ThetaDiff, double _PhiDiff, Vector3 &_In, Vector3 &_Out ) : void
_ThetaHalf double
_PhiHalf double
_ThetaDiff double
_PhiDiff double
_In Vector3
_Out Vector3
return void

half_diff_coords_to_std_coords() public static method

public static half_diff_coords_to_std_coords ( double _ThetaHalf, double _PhiHalf, double _ThetaDiff, double _PhiDiff, double &_ThetaIn, double &_PhiIn, double &_ThetaOut, double &_PhiOut ) : void
_ThetaHalf double
_PhiHalf double
_ThetaDiff double
_PhiDiff double
_ThetaIn double
_PhiIn double
_ThetaOut double
_PhiOut double
return void

std_coords_to_half_diff_coords() public static method

public static std_coords_to_half_diff_coords ( double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut, double &_ThetaHalf, double &_PhiHalf, double &_ThetaDiff, double &_PhiDiff ) : void
_ThetaIn double
_PhiIn double
_ThetaOut double
_PhiOut double
_ThetaHalf double
_PhiHalf double
_ThetaDiff double
_PhiDiff double
return void

Property Details

m_BRDF protected property

protected Vector3[,BRDFSlices m_BRDF
return BRDFSlices.Vector3[

m_Intersections protected property

protected double[,] m_Intersections
return ].double[

m_Pen protected property

protected Pen m_Pen
return Pen

m_Slice protected property

protected Bitmap m_Slice
return Bitmap