Recursive script help needed.

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  05 May 2013
Recursive script help needed.

Hey guys,

I'm new to the forums so bare with me please. We are doing this recursive script and it is just hard to find information that we need, we have gotten this far and can't even delete the parents with leaving the children only..Later on we will want the recursion to happen in one place more than the other by selecting a point, and or placing the recursion on a certain plane or shape..

So my questions are:

1. How do you find the needed info for the syntax? Do you know or have any recursion tutorials?
2. How do you delete the parents each time you make the new children?
3. Is there a way in doing this script more efficiently? (I have a feeling its extremely inefficient)
4. how do you do recursion in one place more than the other by placing a point?
5. how do you place it on a plane then?

Basically I want to learn the basics of maxscript, and I will be browsing throught this forum and other ones at the same time waiting for responses here (because of the lack of time we have). Thank you for you patience and help.

Here is the script (couldn't find a way to attach the file):

resetmaxfile #noprompt

myLevel = 2
radius = 20
a = 180
global triangleRoot = NGon radius:radius nsides:3 scribe:1


fn createChildren parentTriangle currentLevel =
(
if currentLevel < 6 then
(

child01 = copy parentTriangle
child01.radius = (parentTriangle.radius/2)
aRotation = eulerAngles 0 0 a
rotate child01 aRotation

(child01.parent = parentTriangle)

child02 = copy parentTriangle
child02.radius = (parentTriangle.radius/2)
in coordsys parentTriangle move child02 [(parentTriangle.radius/2), 0, 0]

(child02.parent = parentTriangle)

child03 = copy parentTriangle
child03.radius = (parentTriangle.radius/2)
in coordsys parentTriangle move child03 [-(parentTriangle.radius/4), ((sqrt 3)/4)*(parentTriangle.radius)+(1/6)*(parentTriangle.radius) , 0]

(child03.parent = parentTriangle)

child04 = copy parentTriangle
child04.radius = (parentTriangle.radius/2)
in coordsys parentTriangle move child04 [-(parentTriangle.radius/4), -((sqrt 3)/4)*(parentTriangle.radius)+(1/6)*(parentTriangle.radius), 0]

(child04.parent = parentTriangle)

)


currentLevel = currentLevel +1
for i =1 to parentTriangle.children.count by 1 do
(
createChildren parentTriangle.children[i] currentLevel

)
)

createChildren triangleRoot myLevel
delete triangleRoot
 
  05 May 2013
why do you set parent to node and delete the parent after? is it because you are not well with matrix algebra?
 
  05 May 2013
Originally Posted by denisT: why do you set parent to node and delete the parent after? is it because you are not well with matrix algebra?


..........

Last edited by GedSta : 05 May 2013 at 01:51 AM.
 
  05 May 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:13 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.