MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simple display questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126845] Re: Simple display questions
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Wed, 13 Jun 2012 04:54:32 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201206120658.CAA25881@smc.vnet.net>

p0 = {{0, 0, 0}, {2, 1, 2}, {4, 1, 2},
   {3, 3, 2}, {1, 2, 1}, {2, 1, 1}};

p can be generated with Partition

p = Partition[p0, 2, 1, {1, 1}];

c = Table[Hue[Mod[i, 7]/7], {i, Length[p]}];

n = 1;
Graphics3D[
 {Thread[{c, Cylinder[#, 0.07] & /@ p}],
  Text[Style[n, c[[n++]], 18,
      Background -> White], #] & /@ p0},
 Boxed -> True,
 Axes -> True,
 AxesLabel -> {x, y, z},
 ViewPoint -> {20, 20, 20},
 AspectRatio -> 1,
 PlotRange -> {{0, 4}, {0, 4}, {0, 4}}]

Manipulate[
 Column[{
   Graphics[
    {AbsoluteThickness[4],
     c[[1]], Line[{p02[1], p02[2]}],
     c[[2]], Line[{p02[2], p02[3]}],
     c[[3]], Line[{p02[3], p02[4]}],
     c[[4]], Line[{p02[4], p02[5]}],
     c[[5]], Line[{p02[5], p02[6]}],
     c[[6]], Line[{p02[6], p02[1]}]},
    Frame -> True,
    PlotRange -> {{-0.5, 4.5}, {-0.5, 4.5}},
    ImageSize -> 300],
   Round[MousePosition["Graphics"], 0.01]}],
 Evaluate[Sequence @@
   Table[{{p02[n], Most@p0[[n]]}, Locator,
     Appearance -> Style[n, c[[n]], 18,
       Background -> White]},
    {n, Length[p0]}]]]


Bob Hanlon


On Tue, Jun 12, 2012 at 2:58 AM, Ste[hen Gray <stevebg at roadrunner.com> wrote:
> I have this code:
>
> p0 = {{0, 0, 0}, {2,1,2}, {4,1,2}, {3,3,2}, {
>    1,2,1}, {2,1,1}};
> p = Transpose[{p0, Append[Rest[p0], First[p0]]}];
> c = Table[Hue[Mod[i, 7]/7], {i, Length[p]}];
> Graphics3D[Thread[{c, Cylinder[#, 0.07] & /@ p}], Boxed -> True,
>  Axes -> True, AxesLabel -> {x, y, z}, ViewPoint -> {20, 20, 20},
>  AspectRatio -> 1]
>
> I haven't  used Mathematica for 5 years and I have forgotten a lot.
>
> 1. How do I get a label on each point? 1,2,3,4,5,6 would be OK.
> 2. How do I control the size and color, etc. of those labels?
> 3. When I move the six points (actually I use Manipulate), the size of
> the box changes, making the change in the polygon confusing. How do I
> keep the box from changing?
> 4. I assume there is no way to drag the points on the display and have
> the coordinates change accordingly. (Maybe it can in 2D displays?)
>
> Thank you for any info.
>
> Steve Gray
>



  • Prev by Date: Re: modulo solving lacking domain?
  • Next by Date: Re: ToString Awkwardness
  • Previous by thread: Simple display questions
  • Next by thread: Strongly connected graph in mathematica 8?