Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Thickness of Lines and Arcs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31382] Re: Thickness of Lines and Arcs
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 31 Oct 2001 19:59:02 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <9rod88$psh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

Ingolf Dahl wrote:
> 
> Comment to the answers I have got about how to convert 2D graphics to 3D
> graphics:
> The reason why I wrote the question was that I became a bit frustrated when
> I found that some of the 2D graphic primitives (Rectangle, Circle, Disk,
> Raster, RasterArray, PostScript) lack a direct three-dimensional
> counterpart. 

PostScript[] *is* a two dimensional page description language. 
It' can't extended to 3d until Adobe decide to make PostScript
to a 3d model/scene description language. I'm very sure that 
this will never happen.


> In most parts, Mathematica is created with quite a good
> internal consistency and agreement, but evidently that has been difficult to
> achieve here.
> Mark Westwood, Allan Hayes and David Park (private communication) has all
> suggested simple replacement rules to replace the two dimensional
> coordinates in the primitives by three dimensional coordinates, and that can
> work for the primitives that are common for 2D and 3D coordinates, namely
> Point, Line, Polygon and Text, but not for the other.
> For Rectangle, Circle and Disk it should be quite easy to write functions,
> that build up the 3D counterparts from the 3D primitives. For Raster and
> RasterArray it should be more difficult, but maybe the result would be fun
> to play with.

To extend Raster/RasterArray to 3d is simple but for a usual Raster
it will need a huge memory. The 3d extension is called texture mapping
and it is *not* so simple as it seems.

My old PNG Read/Write package for Mathematica 3.0 had the function
to map a bitmap onto a surface.

Something like

makePoly3D[pnts_, col_:{}] :=
  
  Module[{l = pnts, l1 = Map[RotateLeft, pnts], mesh},
    mesh = {l, l1, RotateLeft[l1], RotateLeft[l]};
    mesh = Map[
                       Drop[#, -1] &,
                       Map[
                           Drop[#, -1] &,
                           mesh,
                          {1}
                       ],
                     {2}
                 ];
     mesh = Polygon /@ Transpose[Flatten[#, 1] & /@ mesh];
    If[col == {},
      mesh,
      Transpose[{SurfaceColor /@ col, mesh}]
      ]
    ]

TransformTo3D[Raster[bm_, ___, ColorFunction -> cf_, ___], z_] :=
  
  Module[{pnts, col, nx, ny},
    col = 
      Map[cf, bm/255, {2}] /. {GrayLevel[{a_}] :> GrayLevel[N[a]], 
          RGBColor[l_List] :> RGBColor[Sequence @@ N[l]]};
    {ny, nx} = Take[Dimensions[bm], 2];
    pnts = Table[{x, y, z}, {y, 0, ny}, {x, 0, nx}];
    Show[Graphics3D[{EdgeForm[], makePoly3D[pnts, Flatten[col]]}]]
    ]

will do that. Any way, it seems to be much better to use MathGL3d
and it's MVTexture option for that task.

It is still allmost useless to put a Raster[] just into the z=0
plane. You will have more like texture mapping does.

> For PostScript code it might be possible to add extra
> Postscript commands to perform the 3D-projection. Maybe something for David
> Park to include in his DrawGraphics package (see
> http://home.earthlink.net/~djmp/)? (To me it seems as David Park have
> thought a bit deeper about these things than Wolfram.)
> In version 4.1 of Mathematica, the routine StackGraphics is able to
> transform a 2D circle to a 3D object (built by lines), normal to the y-axis,
> but the same routine does not seem to be able to handle 2D rectangles.
> Consistent? I would prefer to have available a 2D-to-3D routine that is more
> primitive and more well-defined for the user than StackGraphics.
> On a wishing list for a more user-friendly Mathematica I would also like to
> add more user-friendly versions of Rotate3D, RotationMatrix3D, and
> RotateShape. These routines use Euler angles as arguments. How many of us
> have a clear understanding of the ad hoc definition of the Euler angles?

It is not very useful to do 3d graphics with out "a understanding of
Euler angles"
Some people like quaternions, some people like axes/angle
to specify the rotation. It is quite simple to use the rotation matrix
of
the SurfaceOfRevolution package to get an axes/angle rotations, if you
like it more. MathGL3d has also the functions to rotate a 3d object
using the axes/angle description.

Regards
  Jens


  • Prev by Date: Re: weibull distribution
  • Next by Date: RE: Zero does not equal Zero
  • Previous by thread: Re: Thickness of Lines and Arcs
  • Next by thread: Unwanted color in postscript output