Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CS 497: Computer Graphics James Money Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Points and Homogeneous Form Given a Point in the form: x y z we can represent them as a homogeneous point in 4D space: x x y y z z w 1 Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Homogenous Form and Matrices We represent a 3D coordinate in homogenous form to allow easy manipulation with matrices. We use 4x4 matrices to act on these points. I for these matrices is: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. From XYZ to Homogeneous and Back • To make a point into homogeneous x form: y ( x, y , z ) z 1.0 • To make a homogeneous vector into XYZ form again: a b a / w, b / w, c / w; w 0 c w Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Translation To move a point from its current position to (x+a,y+b,z+c) use the matrix: 1 0 0 0 0 1 0 0 0 0 1 0 a x xa b y yb c z zc 1 w w Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Scaling To scale a point by (a,b,c): a 0 0 0 0 b 0 0 0 0 c 0 0 x a*x 0 y b* y 0 z c* z 1 w w Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Rotating in X To rotate a point around the x axis: 1 0 0 0 cos() sin( ) 0 sin( ) cos() 0 0 0 0 0 0 1 Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Rotating in Y To rotate a point around the Y axis: cos() 0 sin( ) 0 0 sin( ) 1 0 0 cos() 0 0 0 0 0 1 Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Rotating in Z To rotate a point around the Z axis: cos() sin( ) sin( ) cos() 0 0 0 0 0 0 1 0 0 0 0 1 Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Combining Matrices • You can combine matrices to simplify the processing of the points. However you must remember, order is important!(ABBA) • If you translate then scale, that is not necessarily the same as scaling then translating. • Also, rotations must be done around (0,0,0) in most cases. In this case, you must translate to the origin, rotate, and then translate back. Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author. Homework Continuation of Last Time! • • • • • Read Chapter 1 Read section 3.6,3.14 Read Chapter 4 if needed. Read Chapter 5. Read Chapter 6. Copyright 1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the author.