Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to make a cube

Subject: how to make a cube

From: diensa refranto

Date: 18 Jan, 2009 12:04:02

Message: 1 of 2

hello .

guys , any sugestion how to make a perfect cube using plane function and orthogonality function , and how create it in matlab

plane function
Axi + Byi + Czi + D ;
orthogonaluty function is use to check the angle inside the cube ..
the angle must 90 degree ,

given data ( is not correct data of a cube ) :
x y z
0.1 0.15 0.1
20.1 0.15 0.1
20.15 20.1 0.1
0.15 20.1 0.15
0.15 0.1 20.1
20.1 0.1 20.15
20.1 20.15 20.15
0.1 20.15 20.1

the solution is how to make that data into correct data :

thx before guys

Subject: how to make a cube

From: Roger Stafford

Date: 20 Jan, 2009 20:30:19

Message: 2 of 2

"diensa refranto" <diensa.refranto@gmail.com> wrote in message <gkv5ri$7jb$1@fred.mathworks.com>...
> guys , any sugestion how to make a perfect cube using plane function and orthogonality function , and how create it in matlab
> plane function
> Axi + Byi + Czi + D ;
> orthogonaluty function is use to check the angle inside the cube ..
> the angle must 90 degree ,
> given data ( is not correct data of a cube ) :
> x y z
> 0.1 0.15 0.1
> 20.1 0.15 0.1
> 20.15 20.1 0.1
> 0.15 20.1 0.15
> 0.15 0.1 20.1
> 20.1 0.1 20.15
> 20.1 20.15 20.15
> 0.1 20.15 20.1
> the solution is how to make that data into correct data :

  You want to "make" a cube out of the given, (though "not correct",) data, but it isn't at all clear what part of this given data is to be preserved. (I assume by 'cube' you mean that all twelve edges are to be of equal length.) Therefore I will answer a slightly different question.

  Suppose you are given two points P1 and P2 as three-element vectors [x1,y1,z1] and [x2,y2,z2] which are known to be adjacent vertices of the cube - that is, vertices at opposite ends of an edge. Suppose further that you are given a third point Q = [x0,y0,z0] which is known to lie somewhere on the plane of a face of the cube containing this P1P2 edge but not colinear with P1 and P2, and in such a way that traversing the triangle sequentially P1, P2, Q will be in the counterclockwise sense as viewed from outside of the cube. From just these three points we can derive a unique cube using matlab:

 E1 = P2-P1; % Vector along the first edge
 d = norm(E1); % Length of cube's 12 edges
 E2 = cross(Q-P2,Q-P1); % Point E2 orthog. to P1P2Q face
 E2 = d/norm(E2)*E2; % Normalize edge E2 to also be of length d
 E3 = cross(E1,E2)/d; % Third orthog. edge E3, also length d
 P3 = P1 + E2; % Now compute the six remaining vertices
 P4 = P3 + E1; % from these three edges
 P5 = P1 + E3;
 P6 = P5 + E1;
 P7 = P5 + E2;
 P8 = P7 + E1;

  The eight points P1, P2, P3, P4, P5, P6, P7, and P8 will be the vertices of the above unique cube.

  Now see if the problem you have in mind can be made compatible with this one.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us