Draw a cube, ABCDA1B1C1D1, with the length of the edge as 1. How to draw this cube and establish a space rectangular coordinate system at the same time. Point A on the bottom is the origin of the coordinate system, the line AB is on the x-axis, the line AD is on the y-axis, and the line AA1 is on the z-axis.
-
$\begingroup$ There is a builtin function Cube represents a regular cube centered at the origin with unit edge length. that does this, You can use it and show the Axes. Give it a try and if you get stick show what you tried and where you had problem. $\endgroup$– NasserJan 29 at 10:22
-
$\begingroup$ Graphics3D[Cube[]]Use this command to draw a cube with an edge length of 1. How to mark the corresponding letter at the vertex? $\endgroup$– csn899Jan 29 at 10:30
-
$\begingroup$ Please ask well-formed questions. It is not a good idea to morph questions after they have been answered. Thanks. $\endgroup$– SyedJan 29 at 13:46
2 Answers
Here is something to get you started. You can add more labels as shown. Basically you use the Text
command to place labels where you want them. Check the Text command options for finer control.
Graphics3D[{
{Opacity[.1], Cuboid[{0, 0, 0}]},
Text["A", {-.1, 0, 0}, {-1, 0}],
Text["B", {1, -.1, 0}, {-1, 0}],
Text["D", {0, 1.1, 0}, {-1, 0}],
Text["A1", {0, 0, 1.1}, {-1, 0}]
},
AxesOrigin -> {0, 0, 0},
PlotRange -> {{-.2, 1.4}, {-.2, 1.4}, {-.2, 1.4}},
Axes -> True, PreserveImageOptions -> False,
AxesLabel -> {"x", "y", "z"},
Ticks -> None, Boxed -> False]
-
$\begingroup$ After drawing the image, can we automatically write the coordinates of vector AB and vector AB1? How to calculate the vector coordinates formed by any two points in the graph? $\endgroup$– csn899Jan 29 at 12:29
-
$\begingroup$ That is to say, after establishing a coordinate system for a solid figure, you want to write out the vector coordinates between any two points in the figure $\endgroup$– csn899Jan 29 at 12:33
Graphics3D[
{FaceForm[None],
Cuboid[{0, 0, 0}],
PointSize[Large],
{Point[#1], Text[Style[#2, Large], #1, {-1, -1}]} & @@@
{{{0, 0, 0}, "A"},
{{1, 0, 0}, "B"},
{{1, 1, 0}, "C"},
{{0, 1, 0}, "D"},
{{0, 0, 1}, "A2"},
{{1, 0, 1}, "B2"},
{{1, 1, 1}, "C2"},
{{0, 1, 1}, "D2"}}},
Boxed -> False]
One can also use labeling with ListPointPlot3D
but in this case it's more hassle than necessary.
-
$\begingroup$ After drawing the image, can we automatically write the coordinates of vector AB and vector AB1? How to calculate the vector coordinates formed by any two points in the graph? $\endgroup$– csn899Jan 29 at 12:29
-
$\begingroup$ That is to say, after establishing a coordinate system for a solid figure, you want to write out the vector coordinates between any two points in the figure $\endgroup$– csn899Jan 29 at 12:33
-
$\begingroup$ @cns899 for this sort of labelling, I'd suggest creating a mesh region of the cube with
BoundaryMeshRegion[Cube[]]
, and usingHighlightMesh
to label cells of different dimensions according to your interest. Anyway, this labelling, be it on a mesh region orGraphics3D
construct tends to mostly involve manual work of specifying vertices, edges, etc. and finding aesthetic layouts for labels. $\endgroup$– kirmaJan 29 at 12:44