Is there any inbuilt function in c++ or c libraries that can be used to find distance between two points in 2-D space
PS: I know how to implement it myself.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, you can use arithmetic on complex numbers:
I realise that this doesn’t quite fulfil your requirement of not writing your own function but the actual distance logic is implemented in the
std::normfunction. It just returns the square of the distance.