Using Optix7 in 2D space,

Can Optix be used for ray tracing in only 2D space? Say I set 1 dimension to 0, when a ray hits the edge of a triangle in 2D space, will it considered a hit?
What is a good starting point in the example codes, if I want to write a simple program using optix, to send multiple rays from an origin to a few triangles in 2D space, any ray hit return the coordinate hit of the hit point?

The OptiX API is 3D, but you can always easily simulate 2D ray tracing in 3D with any 3D API. You would want to convert 2D edges into 3D quads, so a triangle in 2D would become a mesh in 3D. You can always cast rays with all Z values (for example) set to 0. It would be a good idea in that case to set your geometry to have one copy of your vertices with Z < 0, and another copy of your vertices with Z > 0, and then tessellate all the triangles you need in between them such that the cross section slice at Z=0 is the exact set of 2D geometry you want. Does that make sense? In other words, take your 2D geometry and extrude it along the extra dimension (Z in my example), straddling either side of your fixed Z value (e.g., 0).

Good starting places are the optixTriangle, and optixRaycasting samples, and the OptiX Programming Guide.