Question

C++: vectors. Euclidean vectors are sets of values which represent values in a dimensional field. A...

C++:

vectors. Euclidean vectors are sets of values which represent values in a dimensional field. A 2d vector would represent values in x,y space (an ordered pair of coordinates) and a 3d vector would represent values in x,y,z space (an ordered triplet of coordinates). We define the basic definition of the 2d vector as follows:

class Vector2D {

public: Vector2D ();

Vector2D (double ,double );

double dotProduct(Vector2D& );

friend Vector2D& operator +(Vector2D&, Vector2D&);

friend std::ostream& operator <<(std::ostream& o, Vector2D& a);

private:

double magnitude,angle, x, y; };

We continue by implementing this class.

Constructors and member functions (methods):

1)We would like to define two ways to create a 2d vector and a behavior involving two vectors.

(a) First, write the implementation for the default constructor. It should set all the class attributes to the value 0.

(b) Second, write the implementation for the ‘double, double’ constructor. The constructor is given values for the magnitude and angle (in radians) as its parameters. It should set the private variables to those values and calculate the x and y values. The value of x should be the magnitude multiplied by the cosine of the angle (in degrees). The value of y should be the magnitude multiplied by the sine of the angle (in degrees). You can convert between radians and degrees by multiplying the number of radians by 180 and dividing by pi.

(c) Lastly, we write the implementation for the dot product method. The formula for calculating the dot product of two vectors a = {ax, ay} and b = {bx, by} is ax ∗ bx + ay ∗ by.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
C++: vectors. Euclidean vectors are sets of values which represent values in a dimensional field. A...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • 6 ture Supplement 4: Intro Vectors Worksheet B a vector (graphical, verbal, or mathematical) that is...

    6 ture Supplement 4: Intro Vectors Worksheet B a vector (graphical, verbal, or mathematical) that is in: Provide an example of a) ID b) 2D c) 3D (graphi Outline the main vector operations we will use in class: a) Vector Addition b) Vector Subtraction c) Scalar Multiplication d) Vector Dot Product e) Vector Cross Product What is a resultant vector? 4 What is the component of a vector? 3,Define a unit vector. Give an example of a unit vector in...

  • Sarah choose for the class four vectors A, B, C, and D with components: Ax=23.5, Ay=...

    Sarah choose for the class four vectors A, B, C, and D with components: Ax=23.5, Ay= -9.7; Bx=-17.3, By=2.3; Cx=51.9, Cy=-32.5; Dx=-10.1, Dy=-12.2. Determine magnitude and direction (as measured from the positive x-axis) of the vector A+B-C-D *the answer my professor gave was 51.6, -46(angle)

  • Please help with this physics 009 question! I'm especially having trouble figuring out how to calculate...

    Please help with this physics 009 question! I'm especially having trouble figuring out how to calculate the product of the two vectors! And calculating the angle between them! Vector ?⃗ has a magnitude of 16.6 and is at an angle of 30.5∘ counterclockwise from the +?‑axis. Vector ?⃗ has a magnitude of 29.1 and is −50.3∘ from the +?‑axis. Resolve ?⃗ and ?⃗ into components, and express in ??? unit vector form, ?⃗=???+??? ?⃗=???+??? Vector A has a magnitude of...

  • 4. Vectors The angle of the vector could be given measured from either axis (and not...

    4. Vectors The angle of the vector could be given measured from either axis (and not necessarily fr positive x or y axis). How you break the vector into its components depends on where an angle i measured from. Suppose that we know the angle of the vector A relative to the y-axis, as shown (where the angle is now labeled as p). Ax Ay 4.11. When the angle (p)is measured from the y-axis, as above, what are Ax and...

  • 6. 2D vectors Lec ture Supplement 4: Intro Vectors Worksheet B Provide an example of a)...

    6. 2D vectors Lec ture Supplement 4: Intro Vectors Worksheet B Provide an example of a) ID b) 2D c) 3D a vector (graphical, verbal, or mathematical) that is in: (graphi Outline the main vector operations we will use in class: a) Vector Addition b) Vector Subtraction c) Scalar Multiplication d) Vector Dot Product e) Vector Cross Product What is a resultant vector? 4 What is the component of a vector? &Define a unit vector. Give an example of a...

  • Vector A has a magnitude of 19.6 and is at an angle of 70.5º counterclockwise from...

    Vector A has a magnitude of 19.6 and is at an angle of 70.5º counterclockwise from the +x-axis. Vector B has a magnitude of 28.5 and is -35.3 from the +x-axis. Resolve A and B into components, and express in ijk unit vector form, A = Azi + Ayj B = B,i + B, j where Ay, Ay, Bx, and B, are the calculated values of the x- and y-components of vectors A and B, respectively. À= B = Calculate...

  • In this problem, the x and y components of four vectore are given. You will find...

    In this problem, the x and y components of four vectore are given. You will find the magnitude and the direction of the vectors. Report the direction with an angle (in degrees) COUNTERCLOCKWISE from +x axis. Keep 2 decimal places in all answers. -The x and y components of vector A are given as: Ax = 6.0 m, Ay = 8.0 m Its magnitude is: -The direction of vector A (in degrees) is : -The x and y components of...

  • C++ Assignment - Only Implementation file( VectorDouble.cpp file) required. The header file is already given. Please help, thumbs up guaranteed. Chapter 8 discussed vectors, which are like arrays that...

    C++ Assignment - Only Implementation file( VectorDouble.cpp file) required. The header file is already given. Please help, thumbs up guaranteed. Chapter 8 discussed vectors, which are like arrays that can grow in size. Suppose that vectors were not defined in C++. Define a class called VectorDoublethat is like a class for a vector with base type double. Your class VectorDoublewill have a private member variable for a dynamic array of doubles. It will also have two member variables of type...

  • Activity 1-5: Breaking up Vectors into components Every vector can be thought of as two vectors...

    Activity 1-5: Breaking up Vectors into components Every vector can be thought of as two vectors that add together to form a right triangle. One ve point in the horizontal direction while the other will point in the vertical. tor will Ay Dy в, While you can determine the components of vectors Ä, B, C, and D visually above since there are grid lines, you can also use trigonometry to determine the values of each component. For each vector shown...

  • 7. Lec ture Supplement 4: Intro Vectors Worksheet B Provide an example of a) ID b)...

    7. Lec ture Supplement 4: Intro Vectors Worksheet B Provide an example of a) ID b) 2D c) 3D a vector (graphical, verbal, or mathematical) that is in: (graphi Outline the main vector operations we will use in class: a) Vector Addition b) Vector Subtraction c) Scalar Multiplication d) Vector Dot Product e) Vector Cross Product What is a resultant vector? 4 What is the component of a vector? &Define a unit vector. Give an example of a unit vector...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT