1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Algorithms for visual design using the processing language part 1

182 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 182
Dung lượng 3,24 MB

Nội dung

Algorithms for Visual Design Using the Processing Language Algorithms for Visual Design Using the Processing Language Kostas Terzidis Algorithms for Visual Design Using the Processing Language Published by Wiley Publishing, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2009 by Kostas Terzidis Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-37548-8 Manufactured in the United States of America 10 Library of Congress Cataloging-in-Publication Data is available from the publisher No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750‑8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748‑6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose No warranty may be created or extended by sales or promotional materials The advice and strategies contained herein may not be suitable for every situation This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services If professional assistance is required, the services of a competent professional person should be sought Neither the publisher nor the author shall be liable for damages arising herefrom The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002 Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates, in the United States and other countries, and may not be used without written permission All other trademarks are the property of their respective owners Wiley Publishing, Inc is not associated with any product or vendor mentioned in this book Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books To my father, George About the Author Kostas Terzidis is an associate professor at the Harvard Graduate School of Design His current GSD courses are Kinetic Architecture, Algorithmic Architecture, Digital Media I & II, Cinematic Architecture, and Design Research Methods He holds a PhD in Architecture from the University of Michigan (1994), a Masters of Architecture from Ohio State University (1989) and a Diploma of Engineering from the Aristotle University in Greece (1986) He is a registered architect in Europe where he has designed and built several commercial and residential buildings His research work focuses on creative experimentation within the threshold between arts, architecture, and computer science As a professional computer programmer, he is the author of many computer applications on form making, morphing, virtual reality, and self-organization His most recent work is in the development of theories and techniques for algorithmic architecture His book Expressive Form: A Conceptual Approach to Computational Design, published by London-based Spon Press (2003), offers a unique perspective on the use of computation as it relates to aesthetics, specifically in architecture and design His latest book, Algorithmic Architecture, (Architectural Press/Elsevier, 2006), provides an ontological investigation into the terms, concepts, and processes of algorithmic architecture and provides a theoretical framework for design implementations vii 138 Chapter n Motion mouse’s x direction and its previous rotation angle stored in the pr[] array The result of this algorithm can be seen in Figure 6-9 Figure 6-9: Interactive rotation of multiple rectangles 6.5 Double Buffering When we draw on the screen we use the draw() method Every time we call a graphics object, such as a line() or an image(), we are actually writing to the screen sequentially Suppose that we have 1,000 lines to draw on the screen and use the following code: for(int i=0; i height) yspeed *= -1; 13 else if (ypos < 0) yspeed *= -1; 14 xpos = constrain(xpos, 0, width); 15 ypos = constrain(ypos, 0, height); 16 ellipse(int(xpos),int(ypos),diameter,diameter); 17 friction += 0.01; 17 } 18 } Chapter n Motion Here, we define an object (or class) called MyElement This is composed of a size, position, speed, and friction The move() method will eventually draw a circle (line 16) and position it in the screen based on its speed slowed down by the increase in friction Please note that this is a just simple version of friction that applies a change in speed intensity over time Of course, in cases of physics simulations, other methods are being used Lines 10 and 15 are just conditions to keep the element from exceeding the limits of the screen so that when it reaches the frame it reverses direction This appears as if the ball is bouncing off the screen The main code is shown here: 10 11 12 13 14 15 16 17 18 MyElement e = new MyElement(); void setup(){ e.xspeed = random(1); e.yspeed = random(1); } //define an element void draw(){ background(200); e.move(); //draws the element } void mouseDragged(){ if(dist(mouseX,mouseY,e.xpos,e.ypos)

Ngày đăng: 14/12/2022, 21:56

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w