C# Класс AutoStereogramDemo.AutoStereogramBuilder

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

AddCylinder() публичный Метод

public AddCylinder ( Point3D p1, Point3D p2, double radius ) : void
p1 Point3D
p2 Point3D
radius double
Результат void

AddHorizontalPlane() публичный Метод

public AddHorizontalPlane ( double z, CheckPoint checkPoint = null ) : void
z double
checkPoint CheckPoint
Результат void

AddHorizontalPlane() публичный Метод

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
Результат void

AddModelByDepthMap() публичный Метод

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
Результат void

AddPlane() публичный Метод

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
Результат void

AddPlane() публичный Метод

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
Результат void

AddPolygon() публичный Метод

public AddPolygon ( Point3D points ) : void
points Point3D
Результат void

AddRayTracedObject() публичный Метод

public AddRayTracedObject ( Point3D points, GetRayIntersection getRayIntersection ) : void
points Point3D
getRayIntersection GetRayIntersection
Результат void

AddRayTracedObject() публичный Метод

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
Результат void

AddRayTracedObject() публичный Метод

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
Результат void

AddSphere() публичный Метод

public AddSphere ( double xCenter, double yCenter, double zCenter, double radius ) : void
xCenter double
yCenter double
zCenter double
radius double
Результат void

AddSurface() публичный Метод

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
Результат void

AddSurface() публичный Метод

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
Результат void

AddTriangle() публичный Метод

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
Результат void

AutoStereogramBuilder() публичный Метод

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
Результат System

Clear() публичный Метод

public Clear ( ) : void
Результат void

GenerateBitmap() публичный Метод

public GenerateBitmap ( Bitmap backgroundImage ) : Bitmap
backgroundImage System.Drawing.Bitmap
Результат System.Drawing.Bitmap

GenerateBitmap() публичный Метод

public GenerateBitmap ( ColorGenerator colorGenerator = null ) : Bitmap
colorGenerator ColorGenerator
Результат System.Drawing.Bitmap

GetAdditionalHeight() публичный Метод

Height + GetAdditionalHeight(z) * 2 = height of visible area on range Z from the screen
public GetAdditionalHeight ( double z ) : double
z double
Результат double

GetAdditionalWidth() публичный Метод

Width + GetAdditionalWidth(z) * 2 = width of visible area on range Z from the screen
public GetAdditionalWidth ( double z ) : double
z double
Результат double

GetConvexHullProjBoundaries() публичный Метод

public GetConvexHullProjBoundaries ( Point3D points, bool isLeft ) : Rectangle2D
points Point3D
isLeft bool
Результат Rectangle2D