How to plot a distribution of planes
a = .2;
base = Polygon[{{-a, -a, 0}, {-a, a, 0}, {a, a, 0}, {a, -a, 0}}/2];
r = 2 a;
Graphics3D[{
GeometricTransformation[
base,
Flatten[
Table[
TranslationTransform[{x, y, 0}] @* RotationTransform[
{{0, 0, 1}, Cross[{1, 0, .5 y}, {0, 1, -.5 x}]}],
{x, - r, r, a}, {y, - r, r, a}
], 1]
],
{ Thick
,
Blue, (* normal to base*)
Arrow[{#, # + {0, 0, .2}} ]
,
Green, (* spanning vectors *)
Arrow[{#, # + .2 {1, 0, .5 #[[2]]}} ],
Arrow[{#, # + .2 {0, 1, -.5 #[[1]]}} ]
,
Red, (* normal to spanned plane*)
Arrow[{#, # + .2 Cross[{1, 0, .5 #[[2]]}, {0, 1, -.5 #[[1]]}] }]
} &@{r, r, 0}
},
PlotRange -> All, Axes -> True]
and with J.M.'s suggestion about BoxRatios
:
Graphics3D[{
base,
GeometricTransformation[
base,
Flatten[
Table[
TranslationTransform[{x, y, 0}]@*RotationTransform[
{{0, 0, 1}, Normalize@Cross[{1, 0, .5 y}, {0, 1, -.5 x}]}],
{x, -r, r, a}, {y, -r, r, a}
], 1]
]
}, PlotRange -> All, Axes -> True, BoxRatios -> {1, 1, 0.4`}]
a = .1;
r = 5 a;
Here's a very compact version, constructed through the magic of dot products:
With[{a = 1/5, r = 2/5},
Graphics3D[Polygon[Flatten[Table[{x, y, 0} + # & /@
(a {{1, 1}, {-1, 1}, {-1, -1}, {1, -1}} .
{{1, 0, y/2}, {0, 1, -x/2}}/2),
{x, -r, r, a}, {y, -r, r, a}], 1]],
Axes -> True, BoxRatios -> {1, 1, 0.4},
Lighting -> "Classic", PlotRange -> All]]