# How to define values to viewpoint by three points

I have four points.

With three of them I can set a plane.

I know that using three of these points, the fourth point is out of the plan.

pointA={2,5,9};pointB={3,-3,2};pointC={5,-4,-6};pointD={-1,7,8};
Graphics3D[{ Text["A",pointA+.3], Text["B",pointB+.3], Text["C",pointC-.3], Text["D",pointD+.3], Line[{pointA,pointB,pointC,pointD}], Blue, PointSize[.02],Point[pointA],Point[pointB],Point[pointC],Point[pointD] }]


I have two questions:

1. How can I set the viewpoint so that I have a view perpendicular with regard to plane formed by these three points ABC selected. Where the BC segment is horizontal.

2. And what is the distance between the point D to the plane.

PS: I would like to understand the logic of viewpoint.

• The viewpoint ideal as realized can only be obtained by approach through the manipulate... – LCarvalho Aug 29 '16 at 18:50
• That's right? Can't something more accurate? – LCarvalho Aug 29 '16 at 18:50

For convenience, let's first reproduce here the image given in the answer of ViewMatrix from a Graphics3D:

Where the BC segment is horizontal.

If the BC segment is supposed to be horizontal, then ViewVertical (refer to the image) must be orthogonal to BC.

v1 = Normalize[c - b];
v2 = Normalize[(a - b) - Projection[a - b, c - b]];


v1 and v2 are orthogonal to each other. v1 is BC, horizontal by definition, and therefore v2 is the view vertical.

We can also compute

v3 = Cross[v1, v2];


so that we have a complete, orthonormal, basis for the 3D space.

a = {2, 5, 9};
b = {3, -3, 2};
c = {5, -4, -6};
d = {-1, 7, 8};

gr = Graphics3D[{
Text["A", a + .3],
Text["B", b + .3],
Text["C", c - .3],
Text["D", d + .3],
Line[{a, b, c}],
Blue, PointSize[.02],
Point[{a, b, c}],
Red, Point[d],
Black, Opacity[0.2], InfinitePlane[{a, b, c}],
Red, Thick, Opacity[1],
InfiniteLine[{b, b + v1}],
InfiniteLine[{b, b + v2}],
InfiniteLine[{b, b + v3}]
}, PlotRange -> 10]


How can I set the viewpoint so that I have a view perpendicular with regard to plane formed by these three points ABC selected

Again referring to the image, we see that the line between the view center and the view point must be perpendicular to the plane spanned by v1 and v2. By default the ViewCenter is in the middle of the plot range as in the image. For simplicity we choose a plot range that runs between -10 and 10 in all three directions, that way the view center is at (0,0,0). This means that the view point must lie along v3. Testing this:

Show[gr, ViewPoint -> 10 v3, ViewVertical -> v2, Boxed -> False]


We see that this worked out well. The segment BC is horizontal, and only two axes are visible which means that we are looking into the plane at a perpendicular angle.

And what is the distance between the point D to the plane.

The distance is the orthogonal projection of the point onto the plane:

d.v3 // N
(* Out: 0.354459 *)

• Thank you for the answer. Although the question is very similar to another question, I needed a detailed explanation so that I could understand. – LCarvalho Aug 29 '16 at 21:11