44. この後やること
(x, y, z) [mm]
rightからleftの距離[mm]をウィンドウや画像の横のサイズWidth [pixel]に合わせる
right [mm]
Width [pixel]
left [mm]
(right-left) [mm]
検索領域内の相対位置
p.x − left
right − left
45. スキャンラインの3次元データを可視化
int right = 500;
int left = -500;
void draw(){
/*記述省略*/
for(int i = 0; i < depth.width; i++){
int index = depth.width * scanHeight + i;
PVector p = realWorld[index];
float y = (p.z - near) / (far - near);
float x = (p.x - left) / (right - left); //left-right間の相対位置
y = y * height;
x = x * width; //ウィンドウの横方向の座標に変換
vertex(p.x, y); //y座標を書き換える
}
/*以下省略*/
vertex(x, y); //x座標を書き換える