3D でカメラの表示可能な位置を決定するソフトウェアを作成しています。現在、カメラとレンズの固有の特性に基づいて、最小および最大のビューの長さを見つけるためのパーツを実装しています。
カメラが X、Y、Z に配置され、ある方向 (2 つの角度、水平軸の周りに 1 つ、垂直軸の周りに 1 つ) を指している場合、カメラが見ることができる境界は (知っている視野角)。私が望む出力は、最小位置、左上、右上、左下、右下を示す四角形を作成する 4 つの 3D 位置です。最大位置についても同じことが必要です。
これらの点を見つけるためにジオメトリを手伝ってくれる人はいますか?
私が持っているいくつかのコード:
QVector3D CameraPerspective::GetUnitVectorOfCameraAngle()
{
QVector3D inital(0, 1, 0);
QMatrix4x4 rotation_matrix;
// rotate around z axis
rotation_matrix.rotate(_angle_around_z, 0, 0, 1);
//rotate around y axis
rotation_matrix.rotate(_angle_around_x, 1, 0, 0);
inital = inital * rotation_matrix;
return inital;
}
Coordinate CameraPerspective::GetFurthestPointInFront()
{
QVector3D camera_angle_vector = GetUnitVectorOfCameraAngle();
camera_angle_vector.normalize();
QVector3D furthest_point_infront = camera_angle_vector * _camera_information._maximum_distance_mm;
return Coordinate(furthest_point_infront + _position_of_this);
}
ありがとう