You are to write a program to find the minimum distance between two different points on the 3D-Cartesian plane ( ) and a given (reference)
You are to write a program to find the minimum distance between two different points on the 3D-Cartesian plane ( ) and a given (reference) point. i.e. we have three points, one reference points () (x0,y0,z0) and two other points (x1,y1,z1) and (x2,y2,z2).
Note 1: you have to use the predefined pow function
Note2: you have to use predefined min and sqrt functions
Note3: the distance between two points (a, b,c) and (d,e,f) is calculated using the equation: spr(ad)^2+(be)^2+(cf)^2
Constraints
0 <= x0, x1, x2 <= 50
0 <= y0, y1, y2 <= 50
0 <= z0, z1, z2 <= 50
Input Format
The first line, Three integer numbers separated by spaces representing the location coordinates for the reference point
x0, y0,z0
The second line, six integer numbers separated by spaces represent the location coordinates (x, y, z) of the other two points x1, x2, y1, y2, z1, z2
Output Format
The minimum distance between the reference point and the other points.
(use float or double data type for the result without approximation)
Sample #1
Input
1 2 3 4 5 6 7 8 9
Output
7.07107
Sample #2
Input
10 11 12 15 18 19 20 22 30
Output
13.7477
Raise Your hand!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started