I'm not sure what you mean by vector division in your line to line intersection
Sorry I was thinking in shader code, so it's component base math.
If I declare a float2 origine, it mean it's actually origine.xy (float4 would be origine.xyzw)
- so dividing by a float "a" give you origine.x/a and origine.y/a
- but dividing by float2 position (origine/position) would be origine.x/position.x and origine.y/position.y
- dividing only work for scalar (float) or same sized component (float2 can't divide float3 or float4, but a half2 can be)
Translating for easy reading:
o + d * t1 = c + t2 * v
Origine + direction * t = curvePoint + t2 * sweep
o.z + t1 * d.z = 0 + t2 * v.z So t2 = (o.z + t1 * d.z) / v.z
dot(Origine, zAxis) + t1 * dot(direction, zAxis) = 0 + t2 * dot(sweep, zAxis)
t2 = ( dot(Origine,zAxis) + t1 * dot(direction,zAxis) ) / dot(sweep, zAxis)
o + d * t1 = c + (o.z + t1 * d.z) / v.z * v
(o - o.z / v.z * v) + t1 * (d - d.z / v.z * v) = c
A + t1 * B = c
Origine + direction * t1 = curvepoint + ( dot(Origine,Zaxis) + t1 * dot(direction,Zaxis) ) / dot(sweep, zAxis) * sweep
A = (Origine - dot(Origine,zAxis)/ dot(sweep, zAxis) * sweep)
B = (direction - dot(direction, zAxis) / dot(sweep,zAxis) * sweep)
A + t1 * B = c
I'm not sure how I plug a curve in there, let's say I have a simple curve (2x-1)²
I have the ray starting on surface XZ such as raypos (x,0,z) and have a direction normal dn(nx,ny,nz)
I'm assuming the component nx and ny can characterize the projection of normal in the xy plane, but I need to normalized it back, so I would need to use nx1, and ny1 as the normalize projection to get to dnXY(nx1,ny1).
raypos2d(x,0) + dn(nx1,ny1) * t1 is the projected xy ray equation?
Then how do I intersect that with a non parametric form of (2x-1)²?
I guess that Curvepoint( x, (2x+1)² )
then there is an intersection when raypos2d(x,0) + dn(nx1,ny1) * t1 = Curvepoint( x, (2x-1)² ) ?
x + nx1 * t1 = x
t1 = 1/nx1?
0 + ny1 * t1 = (2x-1)²
t1 = (2x-1)² / ny1?
I'm bad at math, I feel like there is a huge chunk I don't know