rotate corners

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
Old 03 March 2013   #1
rotate corners

I'm trying to rotate the column points using the spinner labled Spinn to control the way the verts are affected by the radius values.

See image below for explanation:



Code:
plugin simpleObject CirclesMore name:"Circles" category:"Standard Primitives" classID:#(0x7b105dd6, 0x6cc84fbc) ( parameters main rollout:rltParams ( columns type:#integer default:4 ui:uiColumns XRadius1 type:#float ui:uiXRadius1 default:0 YRadius1 type:#float ui:uiYRadius1 default:0 height type:#worldUnits default:0 ui:uiHeight spinn type:#float ui:uiSpinn default:0.0 ) rollout rltParams "Parameters" ( spinner uiColumns "Columns: " type:#integer range:[3,1e9,0] fieldwidth:50 align:#right offset:[0,0] spinner uiXRadius1 "Radius X:" range:[0,1e9,0] scale:.1 type:#worldunits fieldwidth:50 align:#right offset:[0,0] spinner uiYRadius1 "Radius Y:" range:[0,1e9,0] scale:.1 type:#worldunits fieldwidth:50 align:#right offset:[0,0] spinner uiHeight "Height: " range:[-1e9,1e9,0] type:#worldUnits fieldwidth:50 align:#right offset:[0,6] spinner uiSpinn "Spinn: " range:[-1e9,1e9,0] type:#float fieldwidth:50 align:#right offset:[0,6] ) fn genRadius radA:0.0 radB:0.0 zHeight:0.0 smooth:0.0 = ( local tmpVerts = #() columnAngle = 360.0 / columns subCounter = 0 /* Create Corner Points */ for c = 1 to columns do ( calcX = radA * cos((c-1) * columnAngle) calcY = radB * sin((c-1) * columnAngle) cornerPos = [calcX,calcY,zHeight] append tmpVerts cornerPos ) return tmpVerts ) fn genMesh = ( /*Set Vertices*/ local verticesArr = #() partA = genRadius radA:XRadius1 radB:YRadius1 partB = genRadius radA:XRadius1 radB:YRadius1 zHeight:height /*Append first set of middles and then create the middle ones, lastly append end verts */ join verticesArr partA join verticesArr partB /*Set Faces*/ local facesArr = #() local rowEnd = partA.count as integer colCount = partA.count --tru column count including subdivisions loops = (colCount * 1) for v = 1 to loops do ( if v < rowEnd then ( append facesArr [v+colCount, v, v+1] append facesArr [ v+1 , v+colCount+1 , v+colCount] )else( append facesArr [ v+colCount , v , 1+v-colCount] append facesArr [1+v-colCount, v+1, v+colCount] rowEnd += colCount ) ) /*Set Mesh*/ setMesh mesh verts:verticesArr faces:facesArr triCount = (colCount * 1)*2 for f in #{1..triCount} do setEdgeVis mesh f 3 false for f in #{1..triCount} do setFaceSmoothGroup mesh f 1 ) on buildMesh do (genMesh()) tool create ( local first_pos on mousePoint click do case click of ( 1: (XRadius1 = YRadius1 = 0; coordSys grid (nodeTM.translation = first_pos = gridPoint)) 2: #stop ) on mouseMove click do case click of ( 2: ( XRadius1 = YRadius1 = amax (abs gridDist.x) (abs gridDist.y) if altKey do ( nodeTM.translation = [0,0,0] ) height = gridDist.z ) ) ) )
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 03 March 2013   #2
Just to get it right, are the relative dimensions of the rectangle to the diamond shape important or would just adding spinn in the equation, like cos(spinn + (c-1) * columnAngle) and the same for sin suffice?
__________________
Scripts :: linkedin
 
Old 03 March 2013   #3
as long as the dimensions are relatively close to the spinner size i guess.

Unless there is a way to make the values corresponding the spinners accurately.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 03 March 2013   #4
By adding what you have mentioned seems to help quite a bit though.
It's a little off on accuracy but its not the end of the world.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 03 March 2013   #5
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.
 
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 10:52 PM.


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