Intersection point(s) of a line with the terrain.

I am novice Unity3d pro user.
How to find intersection point(s) of a line and the terrain?
The line may be defined either as line segment {line between two points in 3D space P1(x1,y1,z1), P2(x2,y2,z2)} or as a ray ?

Thx
Adamo

You can use Physics.Linecast (ignoring all layers except the layer you put the terrain in), or -if you have a reference to the terrain collider- Collider.Raycast.