f



Re: from a 2d-figure to an interactive 3d model? is it possible with mathematica? #2

Use Manipulate. Here is a partial example :

Manipulate[
 Module[
  {tan, ll, lr, ur, r, pt, t},
  tan = Tan[30 Degree];
  ll = {-w/2, -d/2};
  lr = {w/2, -d/2};
  ur = {w/2, d/2};
  r = Sqrt[(20 + d/2)^2 + (w/2)^2];
  pt = {x, y} /. FindRoot[
     {tan == (x - w/2)/(y - d/2),
      x^2 + y^2 == r^2}, {x, 12}, {y, 20}];
  t = ArcTan @@ Reverse[pt];
  Graphics[
   {Thin, Circle[{0, 0}, 7],
    Line[{{-7, -4}, {-7, 4}}],
    Circle[{0, 0}, r, -90 Degree + {-t, t}],
    {AbsoluteDashing[{6, 6, 72, 6}],
     Line[{{0, 9}, {0, -22 - d/2}}]},
    {White, EdgeForm[Thick],
     Rectangle[ll, ur]},
    {AbsoluteDashing[{8, 4}],
     Table[Line[lr + # & /@
        {{0, 0}, {0, -x}, {x*tan, -x}, {0, 0}}],
      {x, 10, 20, 5}],
     Line[{ll, -pt}]},
    Text["High-                \ntemperature zone",
     {-4.5, 4}, {-1, 0}],
    Text["B=0.5774*A\nC=1.1547*A", {8, 3.5}, {-1, 0}],
    Text["SI units: 1 in = 25.4 mm; 1 ft = 0.31 m",
     {-w/2 - 15*tan, -23 - d/2}, {-1, 0}],
    Text["B\n5ft 9-5/16in", {w/2 + 5*tan, -10 - d/2}],
    Text["B\n8ft 7-7/8in", {w/2 + 7.5*tan, -15 - d/2}],
    Text["B\n11ft 6-11/16in", {w/2 + 10*tan, -20 - d/2}],
    Text["Intermediate-temperature\nzone",
     {-w/4 - 7.5*tan, -r*Cos[t]}],
    Text["Airflow", {-5*Tan[t], -9.5 - d/2}],
    Arrow[{{-5*Tan[t], -10 - d/2},
      {-5*Tan[t], -13 - d/2}}]}]],
 {{w, 4., "Rectangle\nWidth (ft)"}, 1, 10, .01,
  Appearance -> "Labeled"},
 {{d, 2., "Rectangle\nDepth (ft)"}, 1, 10, .01,
  Appearance -> "Labeled"}]


Bob Hanlon


On Wed, Apr 25, 2012 at 12:34 AM, luke wallace
<lukewallace1990@gmail.com> wrote:
> http://postimage.org/image/jr35rwdel/
>
> the image above represents spacing rules for engineer stuff. if you
> look at it you will see the spacing can be summarized as:
>
> 1. 7 foot radius circle drawn around the center point of the
> rectangle. This never changes no matter what the dimensions of the
> rectangle. So we can ignore this.
>
> 2. On the south side of the rectangle, starting at the left and right
> corners, a 30 degree line is drawn (making a triangle ABC). Once the
> line reaches the 7 foot radius circle, it only goes 13 foot past it
> and then curves like a partial circle, keeping 20 feet maximum
> distance away from the center of the rectangle at all times. This
> changes if the rectangle size is manipulated.
>
> What I need is a way to put this into mathematica or some other
> program so I can make it interactive and say, okay my rectangle is 2
> foot long and 1 foot wide. Then the drawing would update and show what
> it looks like with that size rectangle, and then if someone needed the
> rectangle needs to be 3 foot long and 1.5 foot wide, it would auto
> update again without having to manually re-calculate by hand each
> time?
>

0
hanlonr357 (839)
4/26/2012 9:33:50 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

2 Replies
572 Views

Similar Articles

[PageSpeed] 53

Holy cow. I can't believe that is even possible from just typing code.
It looks like an alien language to me how can I ever hope to know what
I'm doing and write that stuff myself? Are you using some kind of
graphical interface to arrive at that code or something, or are you
just doing math stuff all day?

But please tell me where I can learn to do what you just did, and is
it possible to make the 2D interactive object you guys just made into
a 3D one to also express volume not just area? I mean I know it's
possible theoretically but is it too advanced for an average human
mind to write down in code?

How long did it take you to write that code because to a newbie like
me it looks like it'd take two weeks (it was the first thing I used
mathematica for, took me forever to realize shift+enter makes it
compute then I jumped out of my seat)

0
4/27/2012 10:52:09 AM
Yes, Mathematica is pretty great and you can do all kinds of wonderful and
useful things with it including learning subject matter and writing powerful
technical documents.

But it takes time to learn it and get good at it. How long did it take you
to learn to write good English, or for any person to express themselves well
in their native language? I seem to recall that the schools spend years and
years on such subjects. How much more difficult is it to learn how to do and
write good mathematics? The idea that one could use Mathematica with
facility "out of the box" is something of a delusion. 

This is why those who are aiming for technical careers should be learning
Mathematica as early as possible in secondary school so that when they get
to tackling difficult material they don't have to learn the most basic
things. Unfortunately, very little of this is actually done.

Many students find themselves in the position of having to tackle difficult
course material with Mathematica without knowing Mathematica well enough or
having the time to learn it. That can be very frustrating and not leave a
good first impression of Mathematica.

So if you have a long term interest in mathematical subjects then try to
take time out to learn Mathematica. Work through the tutorials in the
Documentation Center and the Help examples. Try actually typing them in
yourself and making variations. Then try to fly solo by taking SIMPLE
non-Mathematica books and trying to work problems. Try to write tutorials on
various simple topics in which you explain to others how to solve problems
or how some mathematical construction works. It's the best way to learn.
They may even end up being useful to other people.

It really is nice if you can spend the time.


David Park
djmpark@comcast.net 
http://home.comcast.net/~djmpark/index.html 



From: luke wallace [mailto:lukewallace1990@gmail.com] 


Holy cow. I can't believe that is even possible from just typing code.
It looks like an alien language to me how can I ever hope to know what I'm
doing and write that stuff myself? Are you using some kind of graphical
interface to arrive at that code or something, or are you just doing math
stuff all day?

But please tell me where I can learn to do what you just did, and is it
possible to make the 2D interactive object you guys just made into a 3D one
to also express volume not just area? I mean I know it's possible
theoretically but is it too advanced for an average human mind to write down
in code?

How long did it take you to write that code because to a newbie like me it
looks like it'd take two weeks (it was the first thing I used mathematica
for, took me forever to realize shift+enter makes it compute then I jumped
out of my seat)


0
djmpark (1335)
4/28/2012 9:29:44 AM
Reply: