Given three direction cosines l, m and n of a 3-D plane, the task is to check if it is possible to draw a straight line with them or not. Print Yes if possible else print No.
Input: l = 0.258, m = 0.80, n = 0.23
Input: l = 0.70710678, m = 0.5, n = 0.5
Approach: If a straight line forms angle a with positive X-axis, angle b with positive Y-axis and angle c with positive Z-axis then its direction cosines are cos(a), cos(b) and cos(c).
For a straight line, cos2(a) + cos2(b) + cos2(c) = 1.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Represent a given set of points by the best possible straight line
- Program to find third side of triangle using law of cosines
- Check whether a straight line can be formed using N co-ordinate points
- Length of the normal from origin on a straight line whose intercepts are given
- Direction of a Point from a Line Segment
- Count squares of unique dimensions possible from given Straight Lines parallel to the axes
- Maximum points of intersections possible among X circles and Y straight lines
- Count of rectangles possible from N and M straight lines parallel to X and Y axis respectively
- Count squares possible from M and N straight lines parallel to X and Y axis respectively
- Check if three straight lines are concurrent or not
- Check whether two straight lines are orthogonal or not
- Slope of the line parallel to the line with the given slope
- Count straight lines intersecting at a given point
- Count of different straight lines with total n points with m collinear
- Puzzle | Connect 9 circles each arranged at center of a Matrix using 3 straight lines
- Time until distance gets equal to X between two objects moving in opposite direction
- Distance Traveled by Two Trains together in the same Direction
- Maximum possible intersection by moving centers of line segments
- How to check if two given line segments intersect?
- Check whether the point (x, y) lies on a given line
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.