(Sorry, please ignore the last message, I hit the send button by
mistake.)
>> Here is the basic code for creating a sphere:
>>
>> dim modelCode as string
>> modelCode = "3DMetafile ( 1 6 Normal tableofcontents0> )" + CR
>> modelCode = modelCode + Tab + "Container (" + CR
>> modelCode = modelCode + Tab + Tab + "Ellipsoid (" + CR
>> modelCode = modelCode + Tab + Tab + Tab + "0 0 " + Str(rad) +
>> CR // orientation
>> <snip..>
> Actually, I'd say this is the *complex* code for creating a
> sphere. :) All those carriage returns and tabs are not necessary --
> when creating a 3DMF file by hand in a text editor, they're commonly
> used just to neaten things up, but (unlike REALbasic), Quesa doesn't
> care about whitespace, and to use them in code like the above just
> makes the code LESS readable rather than more.
>
> So, start by deleting all those, and the code will already be much
> simpler.
>
> The next step I might suggest is to put a template of the string into
> a string constant, with replacement keys where you want to customize
> it -- you know, "#RAD" for the radius, "#RED" for red, etc. Then
> your code would look like this:
>
> modelCode = kSphereTemplate
> modelCode = ReplaceAllB( modelCode, "#RAD", Str(radius) )
> modelCode = ReplaceAllB( "#RED", Str( clr.Red / 255 ) )
> modelCode = ReplaceAllB( "#GRN", Str( clr.Green / 255 ) )
> modelCode = ReplaceAllB( "#BLU", Str( clr.Blue / 255 ) )
These are great ideas, Joe. So (just to make sure that I have
understood you correctly), I can replace any sequential combination
of CRs and Tabs by a simple space, and it will still work?
>
>> Alternatively, you can go to my website
>>
>> http://www.physics.pomona.edu/sixideas/sicpr.html
>>
>> download the source code to either the 3DEField or 3DBField programs,
>> and look at the PD3D classes. This set of classes are useful for
>> creating "pre-defined" simple objects (colored spheres, cones,
>> arrows, etc.) as well as a viewing window with coordinate axes, with
>> hooks for zooming and rotating the view.
>
> That sounds pretty neat.
If there is any interest, I will try to write up some documentation
and make the classes more widely available.
Best wishes, Tom
-------------------------------------------------------------
This message has been scanned by Postini anti-virus software.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|