C# Class ImprovedNormalMapDistribution.OutputPanel

Show file Open project: Patapom/GodComplex

Public Methods

Method Description
OutputPanel ( IContainer container ) : System
SetAngles ( double _Phi, double _Theta ) : void
UpdateBitmap ( ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

OnPaint ( PaintEventArgs e ) : void
OnPaintBackground ( PaintEventArgs e ) : void
OnSizeChanged ( EventArgs e ) : void

Private Methods

Method Description
ComputeIntersectionExact ( double _Phi, double _Theta, float &x, float &y ) : void
ComputeIntersectionExact ( float &x, float &y ) : void

Computes the intersection of the normal vector with the curve Z=(1-x²)(1-y²) using Newton-Raphson We can parametrize the Normal path as: x = Nx.t y = Ny.t z = Nz.t Injecting this in f(x,y) = (1-x²)(1-y²) we get: f(t) = (1-Nx².t²)(1-Ny².t²) To find the intersection with the normal we subtract Nz.t: f(t) = (1-Nx².t²)(1-Ny².t²) - Nz.t Expanding into: f(t) = Nx².Ny².t^4 - (Nx²+Ny²).t² - Nz.t + 1 And try to find the root f(t) = 0, we need the derivative of f(t): f'(t) = 4.Nx².Ny².t^3 - 2.(Nx²+Ny²).t - Nz.t We perform several iterations of the Newton-Raphson algorithm (http://en.wikipedia.org/wiki/Newton's_method): Starting from t0 = 0; t1 = t0 - f(t0) / f'(t0) t2 = t1 - f(t1) / f'(t1) etc. Until f(t) < epsilon ...

InitializeComponent ( ) : void

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

Transform ( float x, float y, PointF &_P ) : void

Method Details

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

OnPaint() protected method

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void

OnPaintBackground() protected method

protected OnPaintBackground ( PaintEventArgs e ) : void
e PaintEventArgs
return void

OnSizeChanged() protected method

protected OnSizeChanged ( EventArgs e ) : void
e EventArgs
return void

OutputPanel() public method

public OutputPanel ( IContainer container ) : System
container IContainer
return System

SetAngles() public method

public SetAngles ( double _Phi, double _Theta ) : void
_Phi double
_Theta double
return void

UpdateBitmap() public method

public UpdateBitmap ( ) : void
return void