# RGB colors in a rainbow Atzema Spiral

## Recommended Posts

I am trying to work on my RGB colors and rainbows. Here I have a circle and a spiral. They were created with arrays from other scripts. A 3-d lines joins each tick mark to the origin.
Simply put:

I am trying to make the rainbow as I increment across the many tick marks formed by the graph.
I have tried a few things, and noticed that most don't use a parametric scheme, but rather through literal hexadecimal codes.
We need only increment and reach the limit of pi or 2*pi whatnot.
Maybe you can help... how do increment R G B across one revolution? Or just from 0 to 1 as I think I have here. (...well 0 to 1 plus whatever I want to min. as a starter)

Spoiler
```

_countOb = count objects ;
//posQ1

_redK = .001 ;
_greenK = .001  ;
_blueK = .001  ;

_tickK = 1000 ;

_ctTick = _countOb / 3 ;

_pieA = (pi) / 3 ;
_pieB = 2 * ((pi) / 3 );

for [{private  _pc = 0},{_pc < _countOb },{_pc = _pc + 1}] do
{

_bing = (_pc / _tickK)  ;
_ying = (_bing * pi  )  + (  pi / 4)  ;

_bingG = ( _pc / _tickK )   ;
_bingB =  (_pc / _tickK )   ;
_yingG = ( _bingG * pi  ) - _pieB  ;
_yingB = ( _bingB * pi  ) - _pieA ;

_sing =   _ying  - (pi / 2)  ;
_singG =   _yingG - (pi  / 2 ) ;
_singB =   _yingB  - (pi / 2 );

_redK =     sin ( _sing )     ;
_greenK = ( sin ( _singG ) )   ;
_blueK  = ( sin ( _singB ) )  ;

_redK = abs ( _redK ) * 2;
_greenK = abs ( _greenK ) * 2 ;
_blueK = abs ( _blueK ) * 2 ;

_nePos = [ (posQ1 select 0) , (posQ1 select 1) , ( posQ1 select 2) ] ;
_ballA = ( objects select _pc  );

_bpA = getPos _ballA ;

drawLine3D [ _bpA  , _nePos , [_redK ,_greenK ,_blueK , 1] ] ;
//hint (str _redK + "..." + str _greenK+ "..." + str _blueK) ;
//sleep (.05) ;
};

}];

```

https://mathworld.wolfram.com/AtzemaSpiral.html
https://community.bistudio.com/wiki/Lightpoint_Tutorial

Can't quite get the blue to darken up.
If you want to know more about how I made the arrays from other scripts ( powershell ISE ) LMK and I'll post it here.

• 1

##### Share on other sites

...working on rotations and parametric equations... I'll dump some text here later.
(going  a little further in math)

graph above is a cheapshot w/o rotations
if only 'default' was a function ... like _this = default or player = default or _car1equip = default.. which reverts the object to its very first call in the compiler

• 1

##### Share on other sites

(still wondering with what code you achieved this)

(and what LMK is: a collaboration suite?)

(and... to what end you are doing this. Although I admit that does not really matter)

• 1

##### Share on other sites
21 minutes ago, Melody_Mike said:

and what LMK﻿ is

Let Me Know

• 1

##### Share on other sites
1 hour ago, Melody_Mike said:

(still wondering with what code you achieved this)

(and what LMK is: a collaboration suite?)

(and... to what end you are doing this. Although I admit that does not really matter)

I have just started this... I am also making an animated rainbow atm... I intend to use other functions and graphs.... include tangent lines...etc... the idea is to make a very peaceful and active mathematical learning environment in Arma .

Look at these powershell codes... this one defines the spiral above.
Well... first... open powershellISE on your windows computer if you can and get used to that.. all windows usually have one (it)

Spoiler
```
#push all final arrays to the top as a habit
\$spot = "C:\Users\Me\Documents\Arma 3 - Other Profiles\bLAcKmAgE87\missions\powershellArrays.VR"
\$apd = '['
\$finAry2 = "["

\$dir1  = "\powershells.txt"
\$dealy = Test-Path -Path "\$spot\$dir1"
Write-Host \$spot\$dir1

#be very careful when removing items from 'desktop'..last time I removed ...the desktop w/ a lame recovery
if(\$dealy -eq \$true)
{
remove-item "\$spot\$dir1"

}

#\$maxPie = 1.183185
#\$maxPie = 1.35914091423
\$timesDown =  1000

\$maxPie =  1.083185
\$someAry = @()

\$axx = (1)

#\$axxz = (\$axx*([math]::PI) * 2 ) + 1
\$avgTick = 0
for( \$r = 0 ; \$r -lt \$timesDown ; \$r++ )
{

\$yig = \$r / \$timesDown
\$yig = \$yig
\$pie = ([math]::PI * 2 * \$maxPie )  - 1
\$rig = ( (\$yig) )       # (180 / ([math]::PI))
\$rig = ((\$pie ) * (\$rig))  * \$maxPie
\$rig = \$rig + 1

\$regTick = \$avgTick
\$avgTick = \$rig

\$diffTick = \$avgTick - \$regTick
Write-Host \$rig " and delta: " \$diffTick
\$bob = 0

\$bob  = ( ( [math]::Sin(\$rig) ) / ( \$rig ))
\$bob -= ( 2 * ( [math]::Cos(\$rig) ) )
\$bob -= ( (\$rig) * ( [math]::Sin(\$rig) ) )

\$bill = 0
\$bill -= (( [math]::Cos(\$rig) ) / ( \$rig ))
\$bill -= (2 * ( [math]::Sin(\$rig) ) )
\$bill += ( (\$rig) * ( [math]::Cos(\$rig) ) )

\$bob *= \$axx
\$bill *= \$axx

\$test1 = [math]::Abs(\$bob)
\$test2 = [math]::Abs(\$bill)

#Write-Host \$bob + " and " + \$bill

#if( \$test1 -lt \$axxz -and \$test2 -lt \$axxz)
#{
\$noob = \$bob , \$bill

\$someAry += \$noob
#}
}

\$copRig = \$rig
\$copDel = \$diffTick
Write-Host "last is " \$avgTick " and delta " \$diffTick
#notice the output... sometimes a sig. fac. shorter.. this can used to make secret codes
<#
for( \$ra = 1 ; \$ra -lt \$addTicks ; \$ra++ )
{

\$gig = \$copRig + (\$ra * \$copDel)
\$bob = 0
\$bob  = ( ( [math]::Sin(\$gig) ) / ( \$gig ))
\$bob -= ( 2 * ( [math]::Cos(\$gig) ) )
\$bob -= ( (\$gig) * ( [math]::Sin(\$gig) ) )

\$bill = 0
\$bill -= (( [math]::Cos(\$gig) ) / ( \$gig ))
\$bill -= (2 * ( [math]::Sin(\$gig) ) )
\$bill += ( (\$gig) * ( [math]::Cos(\$gig) ) )

\$bob *= \$axx
\$bill *= \$axx
\$noob = \$bob , \$bill

\$someAry += \$noob
}

#>

\$countEnt = \$someAry.Length
Write-Host \$countEnt " by the way "

for( \$r = 0 ; \$r -lt (\$countEnt) ; \$r= \$r + 2)
{

\$yy = \$someAry[\$r+1]

#write-host \$ready + " AND " \$yy
#write-host \$r
if( \$ready -ne '0' -and \$yy -ne '0' )
{

if(\$r -ne ( \$countEnt - 2 ))
{
\$welp += ""+\$yy+'"]],'
\$finAry2 +=  \$welp

}
else
{
\$welp += ""+\$yy+'"]]]'
\$finAry2 +=   \$welp

write-host "last"
#\$welp >> \$spot"\haha.txt"
}
}
}

\$finAry2 >> \$spot"\powershells.txt" ```

....ok so that one is a bit weird... look at this simple circle then... that doesn't use a modulo arithmetic for its final array....

Spoiler
```
#push all final arrays to the top as a habit
\$spot = "C:\Users\Me\Documents\Arma 3 - Other Profiles\bLAcKmAgE87\missions\powershellArrays.VR"
\$apd = '['
\$finAry2 = "["

\$dir1  = "\powershellsC.txt"
\$dealy = Test-Path -Path "\$spot\$dir1"
Write-Host \$spot\$dir1

#be very careful when removing items from 'desktop'..last time I removed ...the desktop w/ a lame recovery
if(\$dealy -eq \$true)
{

remove-item "\$spot\$dir1"

}

\$timesDown =  1000
\$timesDown2 =  \$timesDown - 1

\$someAry = New-Object 'object[,]' \$timesDown , 2

#\$someAry = @()
#(\$axx*([math]::PI) * 2 ) + 1
\$axx = 1
#\$axxz = (\$axx*([math]::PI) * 2 ) + 1
\$axxz = 2
\$someL = @()
\$someR = @()

\$pang = 1000
for( \$r = 0 ; \$r -lt \$timesDown ; \$r++ )
{

\$yig = \$r  / \$timesDown
\$yig = \$yig
\$pie = ([math]::PI * 2)
\$rig = ( (\$yig) )       # (180 / ([math]::PI))
\$rig = ((\$pie ) * (\$rig))
\$rig = \$rig

Write-Host \$rig

\$bob = [math]::Cos(\$rig)

#\$bob  = ( ( [math]::Sin(\$rig) ) / ( \$rig ))
#\$bob -= ( 2 * ( [math]::Cos(\$rig) ) )
#\$bob -= ( (\$rig) * ( [math]::Sin(\$rig) ) )

\$bill = [math]::Sin(\$rig)

#\$bill -= (( [math]::Cos(\$rig) ) / ( \$rig ))
#\$bill -= (2 * ( [math]::Sin(\$rig) ) )
#\$bill += ( (\$rig) * ( [math]::Cos(\$rig) ) )

\$bob *= \$axxz
\$bill *= \$axxz

\$test1 = [math]::Abs(\$bob)
\$test2 = [math]::Abs(\$bill)

#Write-Host \$bob + " and " + \$bill

#if( \$test1 -lt \$axxz -and \$test2 -lt \$axxz)
#{

\$noob = \$bob , \$bill

\$bob = [math]::Round(\$bob, 6)
\$bill = [math]::Round(\$bill, 6)

\$someAry[\$r,0] = \$bob
\$someAry[\$r,1] = \$bill

\$someL += \$bob
\$someR += \$bill

#}
}

\$countEnt = \$timesDown

#\$someAry | Sort

\$moder = 0
for( \$r = 0 ; \$r -lt (\$countEnt) ; \$r= \$r + 1)
{

\$yy = \$someAry[\$r,1]

if(\$moder -ne 1 )
{

\$moder = 1
}
else
{
#write-host \$ready + " AND " \$yy
#write-host \$r
\$moder = 0
}

#if( \$ready -ne 0 -and \$yy -ne 0 )
#{

if(\$r -ne ( \$countEnt - 1))
{
\$welp += ""+\$yy+'"]],'
\$finAry2 +=  \$welp

}
else
{
\$welp += ""+\$yy+'"]]]'
\$finAry2 +=   \$welp

write-host "last"
#\$welp >> \$spot"\haha.txt"
}
#}
}
#\$someAry
\$countEnt
\$finAry2 >> \$spot"\powershellsC.txt"

for( \$rx = 1 ; \$rx -lt (\$countEnt - 1) ; \$rx = \$rx + 1)
{

\$yyx = \$someAry[\$rx,1]
#Write-Host  \$readyx " and " \$yyx

}

write-host "last2"```

that's obviously nuts... you just get a text file in your mission if you got one there...... try to create the directories before using these first so you

don't wipe your stuff...
anyways

its defines an array of coordinates for a circle with a 1000 tick marks with the definitions inputted... the spiral as well... although that one is a little confusing...

With some A3 scripts....lets look...these are called to draw on the map without any rotations thus far...
letslookletslook hei = height in init

Spoiler
```

//private _group1 = "" ;

//private _blam1x = "" ;

//_grpC = 1 ;
//_groupIDBlam = "grp_" + str _grpC ;

//_groupX = missionNamespace getVariable [ _groupX , objNull];
//_groupX = createGroup west;
//_groupX setGroupId [ _groupIDBlam ];

unitNameHandle = "job_" ;
private _blam1 = "grp_1" ;

//partXf = unitsTemp / 2 ;
formulaY = [] ;
formulaYR = [] ;
formulasRev = [] ;
_kk = 1 ;
_kx = 1 ;

_ninetyBump = 0 ;
//_tx = 0 ;
_oddsX= 1 ;

// 0 < t < 2pi

//_perTicks =   unitsTemp  ;
//hint ( str _perTicks + " ticks " ) ;
//sleep (.5) ;

_whatPx = posQ1 select 0 ;
_whatPy = posQ1 select 1 ;
_whatPz = posQ1 select 2 ;
_whatPz = _whatPz + hei ;

posQ1 = [( _whatPx ),( _whatPy ),( _whatPz )] ;

//unitsTemp = 100 ;

private _contentZ = [] ;
_contentZ = loadFile "powershells.txt";
_contentsAry = [] ;
_contentsAry = toArray _contentZ ;
private _asWas = toString _contentsAry ;
_contentZZ = parseSimpleArray  _asWas ;

sleep (.3) ;

private _contentR = [] ;
_contentR = loadFile "powershellsC.txt";
_contentRR = [] ;
_contentRR = toArray _contentR ;
private _asWas2 = toString _contentRR ;
_contentRZZ = parseSimpleArray  _asWas2 ;

hint("circle loaded" ) ;
sleep (.6) ;

private _dimenzOf = [] ;
_dimenzOf = _contentZZ  ;
_arySizeDim = count _dimenzOf ;

private _dimenzOfR = [] ;
_dimenzOfR = _contentRZZ  ;
_arySizeDimR = count _dimenzOfR ;

hint (str _arySizeDim + " as count " + str _arySizeDimR + " as countR ") ;
sleep (.5) ;
_countTicks = 0 ;
{

_doubles = [] ;

_tx = 0 ;
_copV = _countTicks    ;
_copV = _copV * _kk  ;

_tx = _copV + (.001) ;

_racks = _x select 0  ;
_racksY = _x select 1 ;
//_racksZ  = _x select 2 ;
_RX = ( (_racks  ) select 0  );
_RY = ( (_racksY ) select 0  );
//_RZ = ( (_racksZ ) select 0 ) ;
_DX = parseNumber _RX ;
_DY = parseNumber _RY ;
//_DZ = parseNumber _RZ ;
//hint ( str _DX + " ... " + str _DY ) ;
//sleep ( .02 );
_axx  = _kk * _DX ;
_bxx  = _kk * _DY ;
//_cxx = _kk * _DZ ;

_doubles pushBack ( _axx );
_doubles pushBack ( _bxx ) ;
//_doubles pushBack ( _cxx ) ;
formulaY pushBack _doubles ;

_countTicks = _countTicks + 1 ;

} forEach _dimenzOf ;

_countTicksC = 0 ;
{

_doublesC = [] ;

_tx = 0 ;
_copV = _countTicksC    ;
_copV = _copV * _kk  ;

_tx = _copV + (.001) ;

_racks = _x select 0  ;
_racksY = _x select 1 ;
//_racksZ  = _x select 2 ;
_RX = ( (_racks  ) select 0  );
_RY = ( (_racksY ) select 0  );
//_RZ = ( (_racksZ ) select 0 ) ;
_DX = parseNumber _RX ;
_DY = parseNumber _RY ;
//_DZ = parseNumber _RZ ;
//hint ( str _DX + " ... " + str _DY ) ;
//sleep ( .02 );
_axx  = _kk * _DX ;
_bxx  = _kk * _DY ;
//_cxx = _kk * _DZ ;

_doublesC pushBack ( _axx );
_doublesC pushBack ( _bxx ) ;
//_doubles pushBack ( _cxx ) ;
formulaYR pushBack _doublesC ;

_countTicksC = _countTicksC + 1 ;

} forEach _dimenzOfR ;
//hint ( str formulaY );

//sleep 3 ;

countx = 0 ;
county = 0 ;
ticker = 0 ;
_count = 0 ;
_blam = "" ;
_count1 = 1 ;

_countForms = count formulaY  ;
_countFormsR = count formulaYR  ;

hint ( str _countForms + " as formula size " )  ;
sleep (.5) ;
_myDrawUnits = compile preprocessFile "fieldsZones\3DMATH\drawOne\unitsObjects\drawUnits.sqf";
_reDraw = [] ;
_countForms = _countForms - 1 ;
for [{_ig = 0},{_ig < _countForms },{_ig = _ig + 1}] do
{

//sleep (.3);
_drawsField = [ _ig, _count1   ] ;
_reDraw = [ _drawsField ] call _myDrawUnits ;
_count1 = _count1 + 1;

};
hint ( str _count1 + " as fo size " )  ;
sleep (1.5) ;```

... which will call this to draw a single and specific object...

Spoiler
```

hint(str _ig) ;
//sleep 2 ;

_iei  = _count1 ;
_grid = formulaY select _iei  ;

//hint(str _grid ) ;
//sleep 2 ;

_countXX = _count1 ;
_xSpot = (_grid select 0) ;
_ySpot = (_grid select 1) ;
//_zSpot = (_grid select 2) ;
_blam1 = "" ;
_blam1 = "job_"+  (str _countXX );

_zSpot = hei ;

_xSpot = _xSpot * shrinker ;
_ySpot = _ySpot * shrinker ;
_zSpot = _zSpot ;

//hint (str _xSpot) ;
//sleep 2 ;

_whatx = ( posQ1 select 0) + _xSpot  ;
_whaty = ( posQ1 select 1) + _ySpot ;
_whatz = ( posQ1 select 2) + _zSpot ;
//hint (str whatx + "!!!") ;
//sleep 1;

private _posNew = [(_whatx),(_whaty),(_whatz)] ;

_dirMan = getDir partyAnimal ;
_posMan = getPos partyAnimal ;
_distBetweenPoints = _posMan distance2d _posNew ;

//hint (str _distBetweenPoints + "xxx") ;
//sleep 1;
//bumpStack = sqrt ( abs(bumpx * bumpx )+ abs( bumpy * bumpy) ) ;

_partySong = "Cube5cm_ACR" ;
//_partySong = "Sign_Sphere100cm_F" ;
//_partySong = "Sign_sphere10cm_EP1" ;
//_partySong = "Cube5cm_ACR" ;
_blarz = _blam1 + "_" + str _iei  ;
//hint (str _blarz + "ccc") ;
//sleep 1;
//_nameCop =str _blarz  ;

//namo =  str _nameCop  ;
//hint (str namo + "ddd") ;
//sleep 1;
_blarz = createVehicle [ _partySong  , _posNew ,[],0,"CAN_COLLIDE"];
//hideObject _blarz ;
objects pushBack _blarz ;
//hint (str _blarz + "ddd") ;
//sleep 1;

if(_iei  != 0 ) then
{
_pcx = _iei  - 1 ;
_preBall = objects select _pcx ;
_azumith = _blarz getRelDir _preBall ;
_blarz setDir _azumith ;
};
//hint (str _blarz + "eee") ;
//sleep 1;
//otherObjs pushBack _blarz ;
//_blarz enableSimulation false ;
_blarz setObjectTexture  [0,"#(argb,8,8,3)color(0,1,0,1,ca)"];
//_blarz setName _nameCop ;
//hint (str _blarz + "fff") ;
//sleep 1;
_blam1x = unitNameHandle +  (str _count1) + "_m";
markxx = createMarker [ _blam1x, _posNew  ];
markxx setMarkerType  iconMarkers  ;
markxx setMarkerShape "ICON";
```

...what terrrible code! theres old stuff all over the place! nonetheless.. objects are placed which create the spiral... the rainbow is then called....
I have that shown above as a single and simple test call.
posQ1 is where I have a point or position where the graph will start... even though its not in init... still global working

• 1
• 1

##### Share on other sites

For starters: is there a reason you use an elaborate method of defining \$spot\$dir1 instead of getMissionPath?

I will dive into catacaustics when I'm feeling more optimistic about my ability to surprise myself (eg: not at the end of the working week).

• 1

##### Share on other sites
48 minutes ago, Melody_Mike said:

For starters: is there a reason you use an elaborate method of defining \$spot\$dir1 instead of getMissionPath?

I will dive into catacaustics when I'm feeling more optimistic about my ability to surprise myself (eg: not at the end of the working week).

I like the getMissionPath... I'll probably use it... but thats powershell script... without any api...

that's not for Arma so getMissionPath isn't a function

Sorry... your looking at two languages or file types...

a .sqf

and a .ps1

in case you've never heard of or used powershell...

all windows have em
https://docs.microsoft.com/en-us/powershell/

i didn't that 'bat" or \$ could work in Arma... lol

• 1

##### Share on other sites

I wana play a game of pass the AI ... (the object or unit with AI) .. one player.. to another.. with stuff

v1