 
 //Do 1 RK4 step.
 __device__ float4 RK4step(float4 loc, double dt ) {
-	float3 loc3d = make_float3(loc);
-	float4 k1 = tex3D(dataTex, loc3d); // of moet ik hier loc.x,loc.y,loc.z meegeven?
-	float4 k2 = tex3D(dataTex, loc3d+dt*0.5*make_float3(k1));
-	float4 k3 = tex3D(dataTex, loc3d+dt*0.5*make_float3(k2));
-	float4 k4 = tex3D(dataTex, loc3d+dt*make_float3(k3));
+	float3 loc3d = make_float3((loc.x-origin)/spacing,(loc.y-origin)/spacing,(loc.z-origin)/spacing);
+	float4 k1 = tex3D(dataTex, loc3d);
+	float4 k2 = tex3D(dataTex, loc3d+(dt*0.5/spacing)*make_float3(k1));
+	float4 k3 = tex3D(dataTex, loc3d+(dt*0.5/spacing)*make_float3(k2));
+	float4 k4 = tex3D(dataTex, loc3d+(dt/spacing)*make_float3(k3));
 	return dt/6.0*(k1 + 2.0*(k2 + k3) + k4);
 }
 

	int cores = 1;
	int blocks = 1;
	float dt = 1/2.0;
	float4 startloc = {200,125,128,128};
	checkCudaErrors(cudaMalloc(&d_lines,blocks*cores*steps*sizeof(float4)));

	h_lines = (float4*) malloc(blocks*cores*steps*sizeof(float4));

}

void datagen (float4*** data) {
	for (int i=0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
