1
$\begingroup$

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.

$\endgroup$
3
  • $\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$
    – Nasser
    Jan 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$
    – csn899
    Jan 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$
    – Syed
    Jan 29 at 13:46

2 Answers 2

5
$\begingroup$

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.

Mathematica graphics

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]
$\endgroup$
2
  • $\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$
    – csn899
    Jan 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$
    – csn899
    Jan 29 at 12:33
6
$\begingroup$
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]

enter image description here

One can also use labeling with ListPointPlot3D but in this case it's more hassle than necessary.

$\endgroup$
3
  • $\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$
    – csn899
    Jan 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$
    – csn899
    Jan 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 using HighlightMesh to label cells of different dimensions according to your interest. Anyway, this labelling, be it on a mesh region or Graphics3D construct tends to mostly involve manual work of specifying vertices, edges, etc. and finding aesthetic layouts for labels. $\endgroup$
    – kirma
    Jan 29 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.