Point on a Plane between two points

I have a Plane (the class not the gameobject) and two Vector 3 positions.

I am trying to find the point on the line between the two positions that also intersects the plane.

My best idea at the moment is creating a custom plane class that stores the equation of the plane and working it out using algebra however I feel like there is likely a simpler way.


It turns out getting the equation from the plane was not too hard.

Vector3 PointOnPlaneBetweenTwoPoints(Plane p, Vector3 a, Vector3 b){
		Vector3 q = (b-a);
		Vector3 planeEqation;
		Vector3 pointOnPlane = p.ClosestPointOnPlane(Vector3.zero);
		Vector3 normal = p.normal;
		planeEqation = normal;
		float offset = Vector3.Dot(pointOnPlane,normal);
		float t = (offset-Vector3.Dot(a,planeEqation))/Vector3.Dot(q,planeEqation);
		return a+(q*t);

If anyone else ever needs this feel free to use it.