Graphics3Dおよび関連関数のオプションであり,三次元座標の明示的な同次変換行列と射影行列の指定に用いることができる.
ViewMatrix
Graphics3Dおよび関連関数のオプションであり,三次元座標の明示的な同次変換行列と射影行列の指定に用いることができる.
詳細
- ViewMatrixを4×4行列{t,p}のペアに設定することができる.t は三次元同次変換行列,p は三次元射影行列である.
- 変換行列 t が各点でリスト{x,y,z,1}に適用される.射影行列 p は変換の結果のベクトルに適用される.
- 結果が{tx,ty,tz,tw}であれば,各点のスクリーン座標は{tx,ty}/tw で与えられると解釈できる.
- デフォルト設定のViewMatrix->Automaticでは,行列 {t,p} はViewPoint,ViewVertical,ViewAngle等のオプションの設定から自動的に求まる.
- AbsoluteOptionsはViewMatrix->Automaticによって使用される明示的な行列を与える.
- 明示的な設定ViewMatrix->{t,p}は,ViewVector,ViewPointその他のビューオプションの設定に優先する.
例題
すべて開く すべて閉じる例 (2)
t = TransformationMatrix[RescalingTransform[{{-2, 2}, {-2, 2}, {-3 / 2, 5 / 2}}]]p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}};Graphics3D[{Cuboid[{-1, -1, -1}, {1, 1, 1}], Sphere[{0, 0, 1}, 1]}, ViewMatrix -> {t, p}, Boxed -> False, Lighting -> {{"Directional", White, {0, -2, 0}}}]オブジェクトを
軸と
軸の周りで45°回転させる変換tを定義し,次にこれを再スケールする:
t = TransformationMatrix[RescalingTransform[{{-2, 2}, {-2, 2}, {-2, 2}}].RotationTransform[Pi / 4, {1, 0, 0}].RotationTransform[-Pi / 4, {0, 0, 1}]]p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}};Graphics3D[{Cuboid[{-1, -1, -1}, {1, 1, 1}], Sphere[{0, 0, 1}, 1]}, ViewMatrix -> {t, p}, Boxed -> False, Lighting -> {{"Directional", White, {0, -2, 0}}}]スコープ (2)
t[a_] := TransformationMatrix[RescalingTransform[{{-2, 2}, {-2, 2}, {-2, 2}}].RotationTransform[a, {1, 0, 0}]]p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}};Table[Graphics3D[{Cuboid[{-1, -1, -1}, {1, 1, 1}], Sphere[{0, 0, 1}, 1]}, ViewMatrix -> {t[a], p}, Boxed -> False, Lighting -> {{"Directional", White, {{0, -2, 0}, {0, 0, 0}}}}], {a, {0, Pi / 6, Pi / 4, Pi / 3}}]t = TransformationMatrix[RescalingTransform[{{-2, 2}, {-2, 2}, {-2, 2}}]];p1 = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}};
p2 = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}};
p3 = {{0, 1, 0, 0}, {0, 0, 1, 0}, {-1, 0, 0, 0}, {0, 0, 0, 1}};Table[Graphics3D[{Cuboid[{-1, -1, -1}, {1, 1, 1}], Sphere[{0, 0, 1}, 1 / 2], Cylinder[{{1, 0, 0}, {3 / 2, 0, 0}}, 1 / 2]}, ViewMatrix -> {t, p}, Boxed -> False, Lighting -> {{"Directional", White, {{2, -2, 0}, {0, 0, 0}}}}], {p, {p1, p2, p3}}]アプリケーション (1)
斜投影法 (1)
g = BarChart3D[{1, 2, 3, 4, 5}, ColorFunction -> "Rainbow", Method -> {"Canvas" -> None}, Axes -> False, Boxed -> False, FaceGrids -> None]棒グラフを単位立方体に再スケールするする再スケーリング変換行列を定義する:
tr = TransformationMatrix[RescalingTransform[{{-2, 7.5}, {0, 1}, {-2, 7}}]];p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}};oblique[t_, s_] := {{1, 0, s Cos[t], 0}, {0, 1, s Sin[t], 0}, {0, 0, 1, 0}, {0, 0, 0, 1}};Manipulate[Show[g, ViewMatrix -> {tr, oblique[t, s].p}], {{t, Pi / 4}, -Pi, Pi}, {{s, 1 / 10}, 0, 1 / 5}, SaveDefinitions -> True]特性と関係 (1)
tf = RescalingTransform[{{-2, 2}, {-2, 2}, {-2, 2}}].RotationTransform[Pi / 4, {1, 0, 0}].RotationTransform[-Pi / 4, {0, 0, 1}]p = {{1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}};ViewMatrixを使って正面から中央への照明のある正投影を示す:
Graphics3D[{Cuboid[{-1, -1, -1}, {1, 1, 1}], Sphere[{0, 0, 1}, 1]}, ViewMatrix -> {TransformationMatrix[tf], p}, Boxed -> False, Lighting -> {{"Directional", White, {{0, -2, 0}, {0, 0, 0}}}}]明示的なViewPoint,三次元オブジェクトの変換,照明を使っても同じ結果が得られる:
Graphics3D[GeometricTransformation[{Cuboid[{-1, -1, -1}, {1, 1, 1}], Sphere[{0, 0, 1}, 1]}, tf], ViewPoint -> {0, -Infinity, 0}, PlotRange -> {{0, 1}, {0, 1}, {0, 1}}, Boxed -> False, Lighting -> {{"Directional", White, tf[{0, -2, 0}]}}]関連するガイド
テキスト
Wolfram Research (2007), ViewMatrix, Wolfram言語関数, https://reference.wolfram.com/language/ref/ViewMatrix.html (2010年に更新).
CMS
Wolfram Language. 2007. "ViewMatrix." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/ViewMatrix.html.
APA
Wolfram Language. (2007). ViewMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ViewMatrix.html
BibTeX
@misc{reference.wolfram_2026_viewmatrix, author="Wolfram Research", title="{ViewMatrix}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/ViewMatrix.html}", note=[Accessed: 06-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_viewmatrix, organization={Wolfram Research}, title={ViewMatrix}, year={2010}, url={https://reference.wolfram.com/language/ref/ViewMatrix.html}, note=[Accessed: 06-November-2026]}