POST
|
Sure! let me know whenever it is being fixed! and tx again!
... View more
07-20-2020
12:13 PM
|
0
|
0
|
1419
|
POST
|
somehow the const statement prevents print statement... getScopeInWorld = print( [convert(x, scope, world, pos, 0, 0, 0), convert(y, scope, world, pos, 0, 0, 0), convert(z, scope, world, pos, 0, 0, 0)] ) const getConstScopeInWorld = print( [convert(x, scope, world, pos, 0, 0, 0), convert(y, scope, world, pos, 0, 0, 0), convert(z, scope, world, pos, 0, 0, 0)] ) SplitXZ--> alignScopeToAxes(y) split( x, noAdjust ){ 10 : SplitZ }* SplitZ--> split( z, noAdjust ){ 10 : Cell( getConstScopeInWorld ) }* Cell( point )--> point color( rand(), rand(), rand() ) X.
... View more
07-20-2020
12:11 PM
|
0
|
1
|
983
|
POST
|
Tx! Using a const might help indeed, however will it be constant per shape or for the entire rule evaluation? I guess I should be able to test this myself know that I know that I can put a print statement in a function. will test and let you know.
... View more
07-20-2020
12:00 PM
|
0
|
0
|
983
|
POST
|
Hello Guys! I was wondering if there is a way to profile our CGA code, is there a way to determine the number of calls for specific function, time spent in each function, etc. For example: Also I came across something that I am not sure if the call is being done one or three time getScopeInWorld = [ convert( x, scope, world, pos, 0,0,0 ) , convert( y, scope, world, pos, 0,0,0 ) , convert( z, scope, world, pos, 0,0,0 ) ] print( [ getScopeInWorld[0], getScopeInWorld[1], getScopeInWorld[2] ] ) is getScopeInWorld evaluated three time or one time?
... View more
07-17-2020
04:54 AM
|
0
|
4
|
1054
|
POST
|
Great, I thought I was going crazy! tx! any workaround?
... View more
07-17-2020
04:48 AM
|
0
|
1
|
1419
|
POST
|
Found the solution! roundToModulo( inFloat , inBaseFloat ) = inBaseFloat * rint( inFloat / inBaseFloat ) computeQuantizedOffsetXZ = [ roundToModulo( getScopeInWorld[0] , BlockWidthModuloSpace ) - getScopeInWorld[0] , roundToModulo( getScopeInWorld[1] , BlockHeightModuloSpace ) - getScopeInWorld[1] , roundToModulo( getScopeInWorld[2] , BlockLengthModuloSpace ) - getScopeInWorld[2] ] t( computeQuantizedOffsetXZ[0] , computeQuantizedOffsetXZ[1] , computeQuantizedOffsetXZ[2] )
... View more
07-10-2020
10:03 AM
|
0
|
0
|
1419
|
POST
|
I also tried scope->pivot and scope->object without much better results.
... View more
07-08-2020
05:14 AM
|
0
|
0
|
1419
|
POST
|
I have a problem, where I am using convert() to convert scope to world space, apply some world space operation, and then convert it back to scope. based on shape orientation, it either works or behave with unexpected results. Here is my test case /**
* File: transformBug.cga
* Created: 8 Jul 2020 11:07:40 GMT
* Author: dave.lajoie
*/
version "2019.1"
getScopeInWorld =
[ convert( x, scope, world, pos, 0,0,0 ) ,
convert( y, scope, world, pos, 0,0,0 ) ,
convert( z, scope, world, pos, 0,0,0 ) ]
convertWorldToScope(inX, inY, inZ) =
[ convert( x, world, scope, pos, inX , inY , inZ ) ,
convert( y, world, scope, pos, inX , inY , inZ ) ,
convert( z, world, scope, pos, inX , inY , inZ ) ]
getScopeFromWorld =
convertWorldToScope(
getScopeInWorld[ 0 ] ,
getScopeInWorld[ 1 ] ,
getScopeInWorld[ 2 ] )
printData( prefix ) -->
print( "-----------" + prefix + "-----------" )
print( prefix + " scope.sx : " + scope.sx )
print( prefix + " scope.sy : " + scope.sy )
print( prefix + " scope.sz : " + scope.sz )
print( prefix + " getScopeInWorld[0] : " + getScopeInWorld[0] )
print( prefix + " getScopeInWorld[1] : " + getScopeInWorld[1] )
print( prefix + " getScopeInWorld[2] : " + getScopeInWorld[2] )
print( prefix + " getScopeFromWorld[0] : " + getScopeFromWorld[0] )
print( prefix + " getScopeFromWorld[1] : " + getScopeFromWorld[1] )
print( prefix + " getScopeFromWorld[2] : " + getScopeFromWorld[2] )
PutCube -->
s(10,10,10)
i("builtin:cube")
comp(f){ top : color(1,0,0) X. |
bottom : color(0,1,0) X. |
side : color(0,0,1) X. }
@StartRule
TransformTest -->
PutCube
doNoAlignScope
doAlignScopeToAxes
doAlignScopeToAxesX
doAlignScopeToAxesY
doAlignScopeToAxesZ
doAlignScopeToGeometryYupLargest0
doAlignScopeToGeometryZupLargest0
doNoAlignScope -->
printData( "No alignScope" )
Done.
doAlignScopeToAxes -->
alignScopeToAxes()
printData( "alignScopeToAxes()" )
Done.
doAlignScopeToAxesX -->
alignScopeToAxes(x)
printData( "alignScopeToAxes(x)" )
Done.
doAlignScopeToAxesY -->
alignScopeToAxes(y)
printData( "alignScopeToAxes(y)" )
Done.
doAlignScopeToAxesZ -->
alignScopeToAxes(z)
printData( "alignScopeToAxes(z)" )
Done.
doAlignScopeToGeometryYupLargest0 -->
alignScopeToGeometry(yUp, largest, 0)
printData( "alignScopeToGeometry(yUp, largest, 0)" )
Done.
doAlignScopeToGeometryZupLargest0 -->
alignScopeToGeometry(zUp, largest, 0)
printData( "alignScopeToGeometry(zUp, largest, 0)" )
Done. Initial Shape v0 ( -30.0, 0, 30.0 ) v1 ( -30.0, 0, -30.0 ) v2 ( 30.0, 0, -30.0 ) v3 ( 30.0, 0, 30.0 ) Conclusion: whenever the shape is mostly aligned in XYZ, the convert() function appears to work correctly ( 3 cases ) when the return value is approx the same value as the scope. -----------No alignScope----------- No alignScope scope.sx : 60 No alignScope scope.sy : 0 No alignScope scope.sz : 60 No alignScope getScopeInWorld[0] : 30 No alignScope getScopeInWorld[1] : 0 No alignScope getScopeInWorld[2] : -29.99999737731673 No alignScope getScopeFromWorld[0] : 59.99999618530273 >>>>>> expected result <<<<<<< No alignScope getScopeFromWorld[1] : 0 >>>>>> expected result <<<<<<< No alignScope getScopeFromWorld[2] : 60.00000381469727 >>>>>> expected result <<<<<<< -----------alignScopeToAxes()----------- alignScopeToAxes() scope.sx : 59.99999618530273 alignScopeToAxes() scope.sy : 0 alignScopeToAxes() scope.sz : 59.99999618530273 alignScopeToAxes() getScopeInWorld[0] : -30 alignScopeToAxes() getScopeInWorld[1] : 0 alignScopeToAxes() getScopeInWorld[2] : -29.99999737731696 alignScopeToAxes() getScopeFromWorld[0] : 0 alignScopeToAxes() getScopeFromWorld[1] : 0 alignScopeToAxes() getScopeFromWorld[2] : 5.2453660828177817e-06 -----------alignScopeToAxes(x)----------- alignScopeToAxes(x) scope.sx : 59.99999618530273 alignScopeToAxes(x) scope.sy : 0 alignScopeToAxes(x) scope.sz : 59.99999618530273 alignScopeToAxes(x) getScopeInWorld[0] : -30.00000000000011 alignScopeToAxes(x) getScopeInWorld[1] : 0 alignScopeToAxes(x) getScopeInWorld[2] : -29.99999737731696 alignScopeToAxes(x) getScopeFromWorld[0] : -2.2832793598534518e-13 alignScopeToAxes(x) getScopeFromWorld[1] : 0 alignScopeToAxes(x) getScopeFromWorld[2] : 5.2453660828177817e-06 -----------alignScopeToAxes(y)----------- alignScopeToAxes(y) scope.sx : 60 alignScopeToAxes(y) scope.sy : 0 alignScopeToAxes(y) scope.sz : 60 alignScopeToAxes(y) getScopeInWorld[0] : 30 alignScopeToAxes(y) getScopeInWorld[1] : 0 alignScopeToAxes(y) getScopeInWorld[2] : -29.99999737731673 alignScopeToAxes(y) getScopeFromWorld[0] : 59.99999618530273 >>>>>> expected result <<<<<<< alignScopeToAxes(y) getScopeFromWorld[1] : 0 >>>>>> expected result <<<<<<< alignScopeToAxes(y) getScopeFromWorld[2] : 60.00000381469727 >>>>>> expected result <<<<<<< -----------alignScopeToAxes(z)----------- alignScopeToAxes(z) scope.sx : 59.99999618530273 alignScopeToAxes(z) scope.sy : 0 alignScopeToAxes(z) scope.sz : 59.99999618530273 alignScopeToAxes(z) getScopeInWorld[0] : -30.00000000000011 alignScopeToAxes(z) getScopeInWorld[1] : 0 alignScopeToAxes(z) getScopeInWorld[2] : -29.99999737731696 alignScopeToAxes(z) getScopeFromWorld[0] : -2.2832793598534518e-13 alignScopeToAxes(z) getScopeFromWorld[1] : 0 alignScopeToAxes(z) getScopeFromWorld[2] : 5.2453660828177817e-06 -----------alignScopeToGeometry(yUp, largest, 0)----------- alignScopeToGeometry(yUp, largest, 0) scope.sx : 59.99999618530273 alignScopeToGeometry(yUp, largest, 0) scope.sy : 0 alignScopeToGeometry(yUp, largest, 0) scope.sz : 59.99999618530273 alignScopeToGeometry(yUp, largest, 0) getScopeInWorld[0] : 29.99999618530273 alignScopeToGeometry(yUp, largest, 0) getScopeInWorld[1] : 0 alignScopeToGeometry(yUp, largest, 0) getScopeInWorld[2] : -29.99999737731696 alignScopeToGeometry(yUp, largest, 0) getScopeFromWorld[0] : 59.99999237060547 >>>>>> expected result <<<<<<< alignScopeToGeometry(yUp, largest, 0) getScopeFromWorld[1] : 0 >>>>>> expected result <<<<<<< alignScopeToGeometry(yUp, largest, 0) getScopeFromWorld[2] : 60 >>>>>> expected result <<<<<<< -----------alignScopeToGeometry(zUp, largest, 0)----------- alignScopeToGeometry(zUp, largest, 0) scope.sx : 59.99999618530273 alignScopeToGeometry(zUp, largest, 0) scope.sy : 59.99999618530273 alignScopeToGeometry(zUp, largest, 0) scope.sz : 0 alignScopeToGeometry(zUp, largest, 0) getScopeInWorld[0] : -30.00000000000006 alignScopeToGeometry(zUp, largest, 0) getScopeInWorld[1] : 1.3113416343912832e-06 alignScopeToGeometry(zUp, largest, 0) getScopeInWorld[2] : -29.99999737731719 alignScopeToGeometry(zUp, largest, 0) getScopeFromWorld[0] : 1.3113416343912832e-06 alignScopeToGeometry(zUp, largest, 0) getScopeFromWorld[1] : 3.9340243347396608e-06 alignScopeToGeometry(zUp, largest, 0) getScopeFromWorld[2] : 2.6226828140352154e-06 Rotate InitialShape along Y by 45 degs v0 ( -42.42640686035156, 0, 0 ) v1 ( 0, 0, -42.42640686035156 ) v2 ( 42.42640686035156, 0, 0 ) v3 ( 0, 0, 42.42640686035156 ) Conclusion: whenever the shape is NOT aligned in XYZ ( rotated ) the convert() function appears to no work correctly, clearly I am missing something. -----------No alignScope----------- No alignScope scope.sx : 60 No alignScope scope.sy : 0 No alignScope scope.sz : 60 No alignScope getScopeInWorld[0] : 42.42640686035156 No alignScope getScopeInWorld[1] : 0 No alignScope getScopeInWorld[2] : 0 No alignScope getScopeFromWorld[0] : -17.57359313964844 No alignScope getScopeFromWorld[1] : 0 No alignScope getScopeFromWorld[2] : 42.42640686035156 -----------alignScopeToAxes()----------- alignScopeToAxes() scope.sx : 84.85282135009766 alignScopeToAxes() scope.sy : 0 alignScopeToAxes() scope.sz : 84.85282135009766 alignScopeToAxes() getScopeInWorld[0] : -42.42641067504883 alignScopeToAxes() getScopeInWorld[1] : 0 alignScopeToAxes() getScopeInWorld[2] : -42.42640686035156 alignScopeToAxes() getScopeFromWorld[0] : -84.85281372070313 alignScopeToAxes() getScopeFromWorld[1] : 0 alignScopeToAxes() getScopeFromWorld[2] : 0 -----------alignScopeToAxes(x)----------- alignScopeToAxes(x) scope.sx : 84.85282135009766 alignScopeToAxes(x) scope.sy : 0 alignScopeToAxes(x) scope.sz : 84.85282135009766 alignScopeToAxes(x) getScopeInWorld[0] : -42.42640686035156 alignScopeToAxes(x) getScopeInWorld[1] : 5.2453669923124835e-06 alignScopeToAxes(x) getScopeInWorld[2] : 42.42641448974609 alignScopeToAxes(x) getScopeFromWorld[0] : -84.85281372070313 alignScopeToAxes(x) getScopeFromWorld[1] : -2.6226834961562418e-06 alignScopeToAxes(x) getScopeFromWorld[2] : 7.62939453125e-06 -----------alignScopeToAxes(y)----------- alignScopeToAxes(y) scope.sx : 60 alignScopeToAxes(y) scope.sy : 0 alignScopeToAxes(y) scope.sz : 60 alignScopeToAxes(y) getScopeInWorld[0] : 42.42640686035156 alignScopeToAxes(y) getScopeInWorld[1] : 0 alignScopeToAxes(y) getScopeInWorld[2] : 0 alignScopeToAxes(y) getScopeFromWorld[0] : -17.57359313964844 alignScopeToAxes(y) getScopeFromWorld[1] : 0 alignScopeToAxes(y) getScopeFromWorld[2] : 42.42640686035156 -----------alignScopeToAxes(z)----------- alignScopeToAxes(z) scope.sx : 84.85282135009766 alignScopeToAxes(z) scope.sy : 0 alignScopeToAxes(z) scope.sz : 84.85282135009766 alignScopeToAxes(z) getScopeInWorld[0] : 42.42641067504883 alignScopeToAxes(z) getScopeInWorld[1] : -5.2453669923124835e-06 alignScopeToAxes(z) getScopeInWorld[2] : -42.42640686035156 alignScopeToAxes(z) getScopeFromWorld[0] : 3.814697265625e-06 alignScopeToAxes(z) getScopeFromWorld[1] : 2.6226834961562418e-06 alignScopeToAxes(z) getScopeFromWorld[2] : -3.2425410555377008e-13 -----------alignScopeToGeometry(yUp, largest, 0)----------- alignScopeToGeometry(yUp, largest, 0) scope.sx : 60 alignScopeToGeometry(yUp, largest, 0) scope.sy : 0 alignScopeToGeometry(yUp, largest, 0) scope.sz : 60 alignScopeToGeometry(yUp, largest, 0) getScopeInWorld[0] : 42.42640686035156 alignScopeToGeometry(yUp, largest, 0) getScopeInWorld[1] : 0 alignScopeToGeometry(yUp, largest, 0) getScopeInWorld[2] : 0 alignScopeToGeometry(yUp, largest, 0) getScopeFromWorld[0] : -17.57359313964844 alignScopeToGeometry(yUp, largest, 0) getScopeFromWorld[1] : 0 alignScopeToGeometry(yUp, largest, 0) getScopeFromWorld[2] : 42.42640686035156 -----------alignScopeToGeometry(zUp, largest, 0)----------- alignScopeToGeometry(zUp, largest, 0) scope.sx : 60 alignScopeToGeometry(zUp, largest, 0) scope.sy : 60 alignScopeToGeometry(zUp, largest, 0) scope.sz : 0 alignScopeToGeometry(zUp, largest, 0) getScopeInWorld[0] : 4.0531759806089474e-14 alignScopeToGeometry(zUp, largest, 0) getScopeInWorld[1] : 1.3113416343912832e-06 alignScopeToGeometry(zUp, largest, 0) getScopeInWorld[2] : -42.42640686035152 alignScopeToGeometry(zUp, largest, 0) getScopeFromWorld[0] : 9.2725855438402505e-07 alignScopeToGeometry(zUp, largest, 0) getScopeFromWorld[1] : 1.3113416343912832e-06 alignScopeToGeometry(zUp, largest, 0) getScopeFromWorld[2] : 9.2725866807086277e-07 what I would like to do is use the shape origin ( scope.s ) and convert it to world space, apply some operation on world xyz, and then convert it back to scope space. Assume the following shape ( oddly rotated in all three axis , and translated in 3D space ) where the shape is 60x0x60 in size I need to flatten the shape in Z, and then extract the scope origin(xyz) in world space, then quantized the xyz to a specified float modulo, then convert back from world xyz into scope space, so I can reset the modified scope to align with the quantized world space coordinates. ( shown by orange arrow ) I was hoping I could use convert() to the conversion back and forth between scope and world. I am sure I am missing something silly. Tx Dave.
... View more
07-08-2020
05:13 AM
|
0
|
6
|
1554
|
POST
|
Always happens... I am writing a question, and find the answer as soon as the question is posted. GenerateThis() -->
alignScopeToAxes()
split(x, noAdjust)
{
BlockWidthModulo :
split(z, noAdjust)
{
BlockLengthModulo:
alignScopeToAxes()
Test
}*
}* Now my problem is the scope is not fully aligned with world space modulo value. I am close... but still not quite there yet...
... View more
06-30-2020
09:43 AM
|
0
|
2
|
1403
|
POST
|
Note: I did try to use alignAxesSelector() and alignScopeToGeometry() without much success.
... View more
06-30-2020
09:37 AM
|
0
|
0
|
1403
|
POST
|
Hello Everyone, is there a way to split using world space slicer position instead if using the local scope? I want restrict the split() on X and Y along specific world space modulo ( for example: at each 3.455 on X and 3.455 on Y ) This is what I would expect as result however as soon as the shape isn't regular, all break loose, and the local scope kicks, and the slicing axis realigns to the local scope. How can i force the local scope to be aligned with the world XYZ axis when splitting? Tx Dave. GenerateThis -->
split(x, noAdjust)
{
Width :
split(z, noAdjust)
{
Length:
Test
}*
}*
Test -->
s('1,0,'1)
center(z)
setColor( Color )
X.
... View more
06-30-2020
09:34 AM
|
0
|
4
|
1739
|
POST
|
I was able to achieve this using this, but there is got a better way opTopFloor2 --> split(x) { rand(1.0, 7.0) : split(x) { rand(0.0, 1.0) : colorRed X. | rand(0.0, 1.0) : colorGreen X. | rand(0.0, 1.0) : colorBlue X.}* }*
... View more
02-14-2020
08:50 AM
|
0
|
0
|
683
|
POST
|
Hello Guys, Is there a way to change the random value for each iteration during split? opTopFloor --> split(x) { rand(1.0, 5.0) : colorRed X. | rand(1.0, 5.0) : colorGreen X. | rand(1.0, 5.0) : colorBlue X.}* it appears the rand() is evaluated once, instead of each iteration. What I would need is that each iteration {}* would provide a new random number doable? Tx
... View more
02-14-2020
08:46 AM
|
0
|
2
|
742
|
POST
|
Excellent, tx. This is what I ended up doing to make it work. It increases the code complexity, but yeah, that is CGA Tx.
... View more
02-11-2020
04:48 AM
|
0
|
0
|
373
|
Online Status |
Offline
|
Date Last Visited |
06-30-2021
11:14 AM
|