4
1
Given a ray with a point and a vector and a plane with a point and a normal vector to the plane. You have to find the intersection point of the plane and the ray..
So your job if you choose to accept is to write a shortest function that will do the job.
RULES:
The submission must be a complete program
And that's all
INPUT FORMAT:
x y z rx ry rz //gives the ray point and the ray vectors
x y z px py pz //gives the point on the plane and the vector normal to plane
OUTPUT FORMAT:
(x,y,z) //intersection point
Test Case:
2 3 4 0.577 0.577 0.577
7 1 3 1 0 0
(7,8,9)
The shortest codes in bytes win.
References: https://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm thanks orlp for the reference
then i think i should remove it. – Kishan Kumar – 2016-10-02T15:20:25.753
Any specifications as to required precision? Say 3 decimal figures for example? – Luis Mendo – 2016-10-02T15:37:57.677
Do degenerate cases need to be handled? Ray parallel with the plane? Ray coincident with the plane? Any others??? – Digital Trauma – 2016-10-02T23:48:53.367
Nope. Not needed to handle those.. – Kishan Kumar – 2016-10-03T03:04:39.647
2
Some test cases would be nice. Also, relevant.
– orlp – 2016-10-03T10:04:25.590A challenge like this could definitely use test cases; please add some! – Lynn – 2016-10-03T10:16:48.097
1It will be very helpful if the formulae involved are included in the question, else programmers will have to search for them. – rnso – 2016-10-03T13:40:58.597
@rnso i added a working function in my example. But Some one commented that my example is not a program but a function. So removed it. – Kishan Kumar – 2016-10-03T15:11:19.913
@orlp this is my first question of the type. So I'm sorry to the community for my mistakes – Kishan Kumar – 2016-10-03T15:12:36.590
@Lynn will add working testcases soon – Kishan Kumar – 2016-10-03T15:13:00.770
2
I would strongly advice to stop enforcing your very specific input/output rules. They really don't add anything to the challenge.
– Sanchises – 2016-10-04T16:32:30.530ooh. thanks @sanchises for pointing it out.. My bad. Haven't seen those meta posts – Kishan Kumar – 2016-10-04T16:34:57.733
I guess someone had ought to explain to you why nobody seemed to be inclined to follow your rules while still demanding strictness on some other parts :) – Sanchises – 2016-10-04T16:57:51.767
will try to follow the rules i discover on meta. – Kishan Kumar – 2016-10-04T16:59:08.593