Help Needed: Add Axis, Draw Arm Pieces, Rotate Objects

In summary, the conversation involves adding an axis to a current rectangle, drawing two pieces of an arm, and rotating the object using two different axis and angles. The code given includes instructions for creating a rectangle, translating it, and rotating it, but without more context it is unclear what the issue is.
  • #1
student012
2
0
LEASE HELP!

-Add an axis to current rectangle
-Draw both piece of arm
-rotate object first axis 20 degree
--redraw.
-then, rotate 2nd part about 2nd axis to -30degree

my current code for rectangle is
%RECTANGLE('Position', [x y w h])
w=4.5;

%width
h=.5;

%height
x=1.75;y=2.75;

%corner position
xv=[x x+w x+w x x];yv=[y y y+h y+h y];
p1=patch(xv,yv,[0 0 0]);

% original rectangle
T=[-2 -2 -2 -2 -2;-3 -3 -3 -3 -3];
axis equal;
grid on;


R(1,:)=xv;R(2,:)=yv;
p=R+T;

%Translation
alpha=pi/9;
XY=[cos(alpha) -sin(alpha);sin(alpha) cos(alpha)]*p;
Y=patch(p(1,:),p(2,:),'k');
F=patch(XY(1,:),XY(2,:),'k');
T3=[2 2 2 2 2;3 3 3 3 3];
B=XY+T3
y=patch(B(1,:),B(2,:),'k');
 
Physics news on Phys.org
  • #2
your instructions are vague, is this homework?
 
  • #3
yes, its my homeowrk..
Tht's the instruction from my teacher.
 
  • #4
I have no context, so I don't really understand what you're trying to do or what your problem is.
 
  • #5



Hello,

I can see that you are trying to add an axis, draw arm pieces, and rotate objects in your code. To add an axis to your current rectangle, you can use the "hold on" command before drawing the rectangle. This will allow you to add additional objects to your plot without erasing the previous ones.

To draw the arm pieces, you can use the "line" function to draw two lines that will represent the two pieces of the arm. You can specify the starting and ending points of each line, as well as the color and thickness.

To rotate an object, you can use the "rotate" function. This function allows you to specify the object you want to rotate, the angle of rotation, and the axis of rotation. For example, to rotate the first part of the arm 20 degrees around the first axis, you can use the following code:

rotate(p1, [1 0 0], 20)

Similarly, to rotate the second part of the arm -30 degrees around the second axis, you can use the following code:

rotate(p2, [0 1 0], -30)

Remember to redraw your objects after each rotation using the "patch" or "line" function.

I hope this helps. Let me know if you have any further questions. Good luck with your project!
 

Related to Help Needed: Add Axis, Draw Arm Pieces, Rotate Objects

1. What is the purpose of adding an axis?

The axis is a reference point that helps to orient and position objects in space. It allows for more precise measurements and movements.

2. How do I add an axis?

To add an axis, you can use a variety of methods such as using a ruler, a protractor, or a coordinate system. Depending on the software or tools you are using, the steps may vary, but the general process involves selecting a point on the object and defining the x, y, and z coordinates.

3. How do I draw arm pieces?

The process of drawing arm pieces will depend on the design and purpose of the arm. You may need to consider factors such as length, flexibility, and weight. Using drafting software or hand-drawing techniques, you can sketch out the desired shape and dimensions of the arm pieces.

4. How can I rotate objects?

Rotating objects can be done in various ways, depending on the software or tools you are using. In general, you can select the object and use rotation handles or enter specific angles to rotate it. Some software also allows for free-form rotation using the mouse or trackpad.

5. What is the importance of rotating objects?

Rotating objects allows for better visualization and manipulation of the object. It can be helpful in creating different views or angles of the object, as well as making adjustments to its position or orientation. Rotating objects is also essential in certain tasks such as animation or 3D modeling.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Linear and Abstract Algebra
Replies
1
Views
1K
  • Special and General Relativity
Replies
10
Views
810
Replies
4
Views
805
  • Introductory Physics Homework Help
Replies
6
Views
591
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
882
  • Special and General Relativity
Replies
7
Views
738
  • Introductory Physics Homework Help
Replies
5
Views
1K
Replies
3
Views
717
Back
Top