C# Class AutoStereogramDemo.AutoStereogramBuilder

Datei anzeigen Open project: Domanser/AutoStereogramDemo Class Usage Examples

Public Methods

Method Description
AddCylinder ( Point3D p1, Point3D p2, double radius ) : void
AddHorizontalPlane ( double z, CheckPoint checkPoint = null ) : void
AddHorizontalPlane ( double x1, double x2, double y1, double y2, double z, CheckPoint checkPoint = null ) : void
AddModelByDepthMap ( Bitmap image, Point3D origin, Vector3D xVec, Vector3D yVec, Vector3D zVec, double xSize, double ySize, double zSize, bool whiteIsBackground = true ) : void
AddPlane ( double x1, double x2, double y1, double y2, double z1, double z2, double a, double b, double c, double d, CheckPoint checkPoint = null ) : void
AddPlane ( double x1, double x2, double y1, double y2, double z1, double z2, double a, double b, double c, double x0, double y0, double z0, CheckPoint checkPoint = null ) : void
AddPolygon ( Point3D points ) : void
AddRayTracedObject ( Point3D points, GetRayIntersection getRayIntersection ) : void
AddRayTracedObject ( Rectangle2D leftProjBoundaries, Rectangle2D rightProjBoundaries, GetRayIntersection getRayIntersection ) : void

calculate intersections of some figure with rays from eyes through each pixel

AddRayTracedObject ( double x1, double x2, double y1, double y2, double z1, double z2, GetRayIntersection getRayIntersection ) : void
AddSphere ( double xCenter, double yCenter, double zCenter, double radius ) : void
AddSurface ( SurfaceFunc func, double zFarthest, double zClosest ) : void
AddSurface ( SurfaceFunc func, double x1, double x2, double y1, double y2, double zClosest ) : void

create figure using surface function

AddTriangle ( double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3 ) : void
AutoStereogramBuilder ( int xResolution, int yResolution, int subpixelsCount = 1, double pixelWidth = 0.0003, double pixelHeight = 0.0003, double distanceToEyes = 0.5, double distanceBetweenEyes = 0.065 ) : System
Clear ( ) : void
GenerateBitmap ( Bitmap backgroundImage ) : Bitmap
GenerateBitmap ( ColorGenerator colorGenerator = null ) : Bitmap
GetAdditionalHeight ( double z ) : double

Height + GetAdditionalHeight(z) * 2 = height of visible area on range Z from the screen

GetAdditionalWidth ( double z ) : double

Width + GetAdditionalWidth(z) * 2 = width of visible area on range Z from the screen

GetConvexHullProjBoundaries ( Point3D points, bool isLeft ) : Rectangle2D

Private Methods

Method Description
AdjustNearest ( int xLeftProj, int xRightProj, int yProj ) : void

update coordinate of nearest point, which visible through given projection on the screen

DefaultColorGenerator ( Bitmap bitmap, int y, int uniqueColorsCount, int colors ) : void
DivideCell ( SurfaceRenderStackFrame stackFrames, SurfaceFunc func ) : void

calculate point projection for some cell and, if required, divide that cell on subcells and repeat procedure for them

GetCylinderRayIntersection ( Point3D p1, Point3D p2, double radius, int xProj, int yProj, double eyeXPos, double &x, double &z ) : bool
GetEyeXPos ( bool isLeft ) : double
GetPlaneRayIntersection ( int xProj, int yProj, double eyeXPos, double a, double b, double c, double d, double &x, double &z, CheckPoint checkPoint ) : bool
GetSphereRayIntersection ( double xCenter, double yCenter, double zCenter, double radius, int xProj, int yProj, double eyeXPos, double &x, double &z ) : bool
GetXProj ( double x, double z, bool isLeft ) : int

x coordinate of point projection on the screen

GetYProj ( double y, double z ) : int

y coordinate of point projection on the screen

InitPoint ( SurfacePoint &point, double x, double y, double z ) : void
IsDivisionRequired ( SurfaceRenderStackFrame stackFrame, SurfaceFunc func ) : bool
IsDivisionRequired ( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4 ) : bool
SampleImageColorGenerator ( Bitmap bitmap, Bitmap backgroundImage, int y, int uniqueColorsCount, int colors ) : void

Method Details

AddCylinder() public method

public AddCylinder ( Point3D p1, Point3D p2, double radius ) : void
p1 Point3D
p2 Point3D
radius double
return void

AddHorizontalPlane() public method

public AddHorizontalPlane ( double z, CheckPoint checkPoint = null ) : void
z double
checkPoint CheckPoint
return void

AddHorizontalPlane() public method

public AddHorizontalPlane ( double x1, double x2, double y1, double y2, double z, CheckPoint checkPoint = null ) : void
x1 double
x2 double
y1 double
y2 double
z double
checkPoint CheckPoint
return void

AddModelByDepthMap() public method

public AddModelByDepthMap ( Bitmap image, Point3D origin, Vector3D xVec, Vector3D yVec, Vector3D zVec, double xSize, double ySize, double zSize, bool whiteIsBackground = true ) : void
image System.Drawing.Bitmap
origin Point3D
xVec Vector3D
yVec Vector3D
zVec Vector3D
xSize double
ySize double
zSize double
whiteIsBackground bool
return void

AddPlane() public method

public AddPlane ( double x1, double x2, double y1, double y2, double z1, double z2, double a, double b, double c, double d, CheckPoint checkPoint = null ) : void
x1 double
x2 double
y1 double
y2 double
z1 double
z2 double
a double
b double
c double
d double
checkPoint CheckPoint
return void

AddPlane() public method

public AddPlane ( double x1, double x2, double y1, double y2, double z1, double z2, double a, double b, double c, double x0, double y0, double z0, CheckPoint checkPoint = null ) : void
x1 double
x2 double
y1 double
y2 double
z1 double
z2 double
a double
b double
c double
x0 double
y0 double
z0 double
checkPoint CheckPoint
return void

AddPolygon() public method

public AddPolygon ( Point3D points ) : void
points Point3D
return void

AddRayTracedObject() public method

public AddRayTracedObject ( Point3D points, GetRayIntersection getRayIntersection ) : void
points Point3D
getRayIntersection GetRayIntersection
return void

AddRayTracedObject() public method

calculate intersections of some figure with rays from eyes through each pixel
public AddRayTracedObject ( Rectangle2D leftProjBoundaries, Rectangle2D rightProjBoundaries, GetRayIntersection getRayIntersection ) : void
leftProjBoundaries Rectangle2D
rightProjBoundaries Rectangle2D
getRayIntersection GetRayIntersection
return void

AddRayTracedObject() public method

public AddRayTracedObject ( double x1, double x2, double y1, double y2, double z1, double z2, GetRayIntersection getRayIntersection ) : void
x1 double
x2 double
y1 double
y2 double
z1 double
z2 double
getRayIntersection GetRayIntersection
return void

AddSphere() public method

public AddSphere ( double xCenter, double yCenter, double zCenter, double radius ) : void
xCenter double
yCenter double
zCenter double
radius double
return void

AddSurface() public method

public AddSurface ( SurfaceFunc func, double zFarthest, double zClosest ) : void
func SurfaceFunc
zFarthest double determines bounds of the grid (grid must coincide with visible region)
zClosest double determines base grid cell size
return void

AddSurface() public method

create figure using surface function
public AddSurface ( SurfaceFunc func, double x1, double x2, double y1, double y2, double zClosest ) : void
func SurfaceFunc
x1 double
x2 double
y1 double
y2 double
zClosest double
return void

AddTriangle() public method

public AddTriangle ( double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3 ) : void
x1 double
y1 double
z1 double
x2 double
y2 double
z2 double
x3 double
y3 double
z3 double
return void

AutoStereogramBuilder() public method

public AutoStereogramBuilder ( int xResolution, int yResolution, int subpixelsCount = 1, double pixelWidth = 0.0003, double pixelHeight = 0.0003, double distanceToEyes = 0.5, double distanceBetweenEyes = 0.065 ) : System
xResolution int Horizontal resolution of stereogram
yResolution int Vertical resolution of stereogram
subpixelsCount int Number of subpixels
pixelWidth double Width of pixel, in meters
pixelHeight double Height of pixel, in meters
distanceToEyes double Distance between stereogram and eyes, in meters
distanceBetweenEyes double Distance between eyes, in meters
return System

Clear() public method

public Clear ( ) : void
return void

GenerateBitmap() public method

public GenerateBitmap ( Bitmap backgroundImage ) : Bitmap
backgroundImage System.Drawing.Bitmap
return System.Drawing.Bitmap

GenerateBitmap() public method

public GenerateBitmap ( ColorGenerator colorGenerator = null ) : Bitmap
colorGenerator ColorGenerator
return System.Drawing.Bitmap

GetAdditionalHeight() public method

Height + GetAdditionalHeight(z) * 2 = height of visible area on range Z from the screen
public GetAdditionalHeight ( double z ) : double
z double
return double

GetAdditionalWidth() public method

Width + GetAdditionalWidth(z) * 2 = width of visible area on range Z from the screen
public GetAdditionalWidth ( double z ) : double
z double
return double

GetConvexHullProjBoundaries() public method

public GetConvexHullProjBoundaries ( Point3D points, bool isLeft ) : Rectangle2D
points Point3D
isLeft bool
return Rectangle2D