AW - create orient based on N

vector up = set(0, 1, 0); // Start with an arbitrary up vector
vector N = normalize(v@N); // Ensure the normal is normalized

// Step 1: Calculate a perpendicular tangent vector
vector tangent = normalize(cross(up, N));

// Step 2: Recalculate the up vector to make it orthogonal
up = normalize(cross(N, tangent));

// Step 3: Create a 3x3 matrix from normal, tangent, and up vectors
matrix3 mat = set(tangent, up, N);

// Step 4: Convert the matrix to a quaternion
p@orient = quaternion(mat);