# Calculating Parabolic Curves in 3D Space

Write a program or function that will determine if a point in 3D space lies on a 2D parabolic curve.

## Input

3 points in 3D space

• vertex of a 2D parabolic curve

• arbitrary point on the curve

• arbitrary point in space

Input may be taken in any form (string, array, etc.) provided no other data is passed.

You may assume

• the axis of a parabola will be parallel to the z axis

• the vertex of a parabola has the maximal z value

• parabolae will never degenerate

• point values will be whole numbers that are ≥ -100 and ≤ 100

## Output

A truthy/falsey value representing whether the third point given lies on the parabolic curve of the first two points.

## Examples

Input:

(2, 1, 3)
(1, 0, 1)
(4, 3, -5)


Output:

1


Input:

(16, 7, -4)
(-5, 1, -7)
(20, 6, -4)


Output:

0


## Walkthrough (Example #1)

1. Find a third point on the curve. To do this, mirror the arbitrary point (on the curve) over the vertex. Here is a visual (each blue line is √6 units): 2. Find the parabolic curve between the three. This is easiest on a 2D plane. Here is the 3D graph, translated to a 2D graph (each blue line is √6 units): 3. Graph the third given point and solve.  • I'll have a Jelly answer in five minutes. Feb 12, 2016 at 4:23
• @ThomasKwa its been 6 minutes. Feb 12, 2016 at 4:24
• @Maltysen Sorry for the disappointment; I think a feature may have changed. Feb 12, 2016 at 4:30
• by "axis of the parabola is parallel to z-axis" you mean that the plane containing the parabola is parallel to the z-axis?
– Liam
Feb 12, 2016 at 7:57
• @Liam both the plane containing the parabola, and also its plane of symmetry. The intersection of those two planes defines the axis. Feb 12, 2016 at 13:06

_÷/µḢ²=A;$P  The input format is a bit strange; it takes P1 as the second argument, and (P3,P2) as the first argument, where each point is expressed in the form ((x+yj),z). We first normalize the points so that the vertex is on the origin, and then make sure that P1 and P2 are on the same line, and also that the ratio of their z distances is equal to the ratio of their x distances. _÷/ Helper link. Inputs: (P3,P2) on left, P1 on right. _ Subtract right from left. (P3-P1,P2-P1). ÷/ Fold division. (P3-P1)/(P2-P1). P2-P1 is nonzero in both x+yi and z. µ Push the chain onto the stack, and start a new monadic link. Ḣ²=A;$P     Hook; main link. Calculates whether w² = a and a is nonnegative.