Question
complete the following c++ functions /** * @fn bool isOrthogonal(const dvec3 &a, const dvec3 &b) * @brief Determines if two vectors are orthogonal, or nearly
complete the following c++ functions
/** * @fn bool isOrthogonal(const dvec3 &a, const dvec3 &b) * @brief Determines if two vectors are orthogonal, or nearly orthogonal. The inputs are non-zero vectors. Two vectors are nearly orthogonal if the cosine of the angle formed by these two vectors is approximatelyZero(). * @param a The first vector. * @param b The second vector. * @return True iff the two vector are orthogonal. */
bool isOrthogonal(const dvec3& a, const dvec3& b) { }
/** * @fn bool formAcuteAngle(const dvec3 &a, const dvec3 &b) * @brief Determines if two vectors form an angle that is * Programming constraint: Do NOT use acos, atan, or asin (you CAN use dot, cos, etc) * @param a The first vector. * @param b The second vector. * @return True iff the two vectors form an acute angle. */
bool formAcuteAngle(const dvec3& a, const dvec3& b) { }
/** * @fn double cosBetween(const dvec2 &v1, const dvec2 &v2) * @brief Cosine between v1 and v2. The inputs are non-zero vectors. * @param v1 The first vector. * @param v2 The second vector. * @test cosBetween(dvec2(1.0, 0.0), dvec2(1.0, 0.0)) --> 1.0 * @test cosBetween(dvec2(1.0, 0.0), dvec2(1.0, 1.0)) --> 0.707107 * @test cosBetween(dvec2(-1.0, glm::sqrt(3.0)), dvec2(-1.0, 0.0)) --> 0.5 * @test cosBetween(dvec2(-1.0, glm::sqrt(3.0)), dvec2(1.0, glm::sqrt(3.0))) --> 0.5 * @return The cosine between v1 and v2. */
double cosBetween(const dvec2& v1, const dvec2& v2) { }
/** * @fn double cosBetween(const dvec3 &v1, const dvec3 &v2) * @brief Computes the cosine between v1 and v2. * @param v1 The first vector. * @param v2 The second vector. * @return A double. */
double cosBetween(const dvec3& v1, const dvec3& v2) { }
/** * @fn double cosBetween(const dvec4 &v1, const dvec4 &v2) * @brief Computes the cosine between v1 and v2. * @param v1 The first vector. * @param v2 The second vector. * @return A double. */
double cosBetween(const dvec4& v1, const dvec4& v2) { }
/** * @fn double areaOfParallelogram(const dvec3 &v1, const dvec3 &v2) * @brief Computes the area of parallelogram, given two vectors eminating * from the same corner of the parallelogram. * @param v1 The first vector. * @param v2 The second vector. * @test areaOfParallelogram(dvec3(1.0, 0.0, 0.0), dvec3(0.0, 1.0, 0.0)) --> 1.0 * @test areaOfParallelogram(dvec3(1.0, 1.0, 1.0), dvec3(1.0, 0.0, 1.0)) --> 1.41421 * @return Area of parallelogram. */
double areaOfParallelogram(const dvec3& v1, const dvec3& v2) { }
/** * @fn double areaOfTriangle(const dvec3 &pt1, const dvec3 &pt2, const dvec3 &pt3) * @brief Computes the area of triangle. * Programming constraint: use areaOfParalellogram to solve this one. * @param pt1 The first point. * @param pt2 The second point. * @param pt3 The third point. * @test areaOfTriangle(dvec3(0.0, 0.0, 0.0), dvec3(1.0, 0.0, 0.0), dvec3(0.0, 1.0, 0.0)) --> 0.5 * @test areaOfTriangle(dvec3(-10.0, -10.0, -10.0), dvec3(-11.0, -10.0, -10.0), dvec3(-10.0, -11.0, -10.0)) --> 0.5 * @return Area of triangle. */
double areaOfTriangle(const dvec3& pt1, const dvec3& pt2, const dvec3& pt3) { }
/** * @fn dvec3 pointingVector(const dvec3 &pt1, const dvec3 &pt2) * @brief Computes unit-length pointing vector. * @param pt1 The first point. * @param pt2 The second point. * @return Unit length vector that points from pt1 toward pt2. */
dvec3 pointingVector(const dvec3& pt1, const dvec3& pt2) { return dvec3(0, 0, 0); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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