http://www.integral-calculator.com/
http://www.derivative-calculator.net/
Mirroring
#pragma kernel CSMain // Thread group size #define thread_group_size_x 32 #define thread_group_size_y 1 #define thread_group_size_z 1 struct Particle { float3 position; float3 velocity; int wait; }; int app_mode; float time; float pi; float deltaTime; float damping; float3 base; // HANDLE. float3 orbit; // BOB float targetStrengh; // POWER MAG float orbit_weighting; // POWER RATIO BETWEEN HANDLE AND BOB float radius_of_action; // RADIUS OF TROUGH / MOTE :) around ATTRACTOR int attractor_Count; float3 att_0; float3 att_1; float3 att_2; float3 att_3; float3 att_4; float3 att_5; float3 att_6; float3 att_7; float3 att_8; float3 att_9; float3 att_10; float3 att_11; float3 att_12; float3 att_13; float3 att_14; float3 att_15; float3 att_16; float3 att_17; float3 att_18; float3 att_19; float constVel; RWStructuredBuffer <Particle> particles; [numthreads(thread_group_size_x, thread_group_size_y, thread_group_size_z )] void CSMain ( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex ) { int index = DTid.x; //int index = DTid.x + DTid.y * thread_group_size_x * 32; if(app_mode == 0) //Platonics Mode { float3 velTemp = particles[index].velocity; if(attractor_Count == 1 || attractor_Count == 2 || attractor_Count == 3 ) { float3 att_0_Dir = normalize((att_0 - particles[index].position)); float att_0_dist = distance(att_0, particles[index].position); velTemp += targetStrengh * att_0_Dir * deltaTime / att_0_dist; if(attractor_Count == 2 || attractor_Count == 3 ) { float3 att_1_Dir = normalize((att_1 - particles[index].position)); float att_1_dist = distance(att_1, particles[index].position); velTemp += targetStrengh * att_1_Dir * deltaTime / att_1_dist; if(attractor_Count == 3 ) { float3 att_2_Dir = normalize((att_2 - particles[index].position)); float att_2_dist = distance(att_2, particles[index].position); velTemp += targetStrengh * att_2_Dir * deltaTime / att_2_dist; } } if(dot(normalize(velTemp), normalize(particles[index].velocity)) > 0.707 && particles[index].wait == 0) { particles[index].velocity = velTemp; } else if(particles[index].wait == 0) { particles[index].wait = 100; } else { particles[index].wait = particles[index].wait - 1; if(particles[index].wait == 0) { particles[index].velocity = velTemp; } } particles[index].position += particles[index].velocity; } else if(attractor_Count == 4 || attractor_Count == 6 || attractor_Count == 8 || attractor_Count == 12 || attractor_Count == 13 || attractor_Count == 20) {