1 Chapter 10 Behavior and Interaction  To understand dynamic behaviors in graphics  To understand Java 3D Behavior and WakeupCondition classes  To apply.

Slides:



Advertisements
Similar presentations
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 10 Behavior and Interaction.
Advertisements

1 Chapter 7 Graphics and Event Handling. 2 Overview The java.awt and javax.swing packages and their subpackages support graphics and event handling. Many.
Event Handling. In this class we will cover: Basics of event handling The AWT event hierarchy Semantic and low-level events in the AWT.
Scenegraph. Scenegraph Nodes - all implement a run function Leaf/Geo Nodes - typedefs of sgNode superclass –Poly Mesh A geo node that stores a list of.
Lecture21 Other Java Gamming technologies – Java3D (This lecture will not be assessed)
Event Handling Events and Listeners Timers and Animation.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 11 Animation F To understand the.
Lecture22 Java3D - Interaction - This lecture will not be assessed.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 8 Views F Views in 3D rendering process.
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Java 3D Pablo Figueroa University of Alberta April 2000.
More OOP Design Patterns
Basic 3D Graphics Chapter 5. Bird’s Eye View  Basic 3D Graphics –Basic concepts of 3D graphics, rendering pipeline, Java 3D programming, scene graph,
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
Chapter 12 Applets and Advanced Graphics  The Applet Class  The HTML Tag F Passing Parameters to Applets F Conversions Between Applications and Applets.
Mouse-Based Viewing & Navigation Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 3, 2003.
ACM/JETT Workshop - August 4-5, ExceptionHandling and User Interfaces (Event Delegation, Inner classes) using Swing.
Chapter 12 Inheritance and Exceptions Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas,
CS324e - Elements of Graphics and Visualization Checkerboard World.
Java3D Overview Scene graph Java 3D classes Describing objects Groups, transforms Behaviors, interpolators Lighting.
ANSYS Fundamentals This document contains no technical data subject to the EAR or the ITAR.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
A Simple Talk on Java 3D Presented by C.H. Chen on Jul. 6, 2004.
Chapter 12 Applets and Advanced GUI  The Applet Class  The HTML Tag F Passing Parameters to Applets F Conversions Between Applications and Applets F.
Graphics Concepts CS 2302, Fall /3/20142 Drawing Paths.
Cs884(Prasad)java12AWT1 Abstract Windowing Toolkit Support for Graphical User Interface (Event-driven programming)
(c) University of Washington07b-1 CSC 143 Java Events, Event Handlers, and Threads Reading: Ch. 17.
Introduction to Windows Programming
Chapter 9: Visual Programming Basics Object-Oriented Program Development Using Java: A Class-Centered Approach.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Chapter 5: Ball Worlds Features 2 classes, constant data fields, constructors, extension through inheritance, graphics.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
CS324e - Elements of Graphics and Visualization Java 3D Intro.
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
Object Oriented Programming.  Interface  Event Handling.
CSE 331 Software Design & Implementation Hal Perkins Autumn 2012 Event-Driven Programming 1.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Interface Opportunities for 3D Data and Media User Interface Software TechNote Panel Virginia Tech CS Fall 2002 Nicholas F. Polys Umur Yilmaz Will Lee.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 27 JavaBeans and.
CS324e - Elements of Graphics and Visualization Timing Framework.
Swing - 2 Session 13. Swing - 2 / 2 of 38 Objectives (1) Discuss trees and tables Discuss progress bars Discuss MVC architecture Describe menus.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
1 5. Behavior Objects  Both interaction and animation are specified with objects  Both interaction and animation are specified with Behavior objects.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 5 Basic 3D Graphics.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android.
Session 7 Introduction to Inheritance. Accumulator Example a simple calculator app classes needed: –AdderApp - contains main –AddingFrame - GUI –CloseableFrame.
Further Abstraction Techniques Chapter 10. Abstract Classes There are times when you do not want someone to be able to make an object of your class. For.
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
By: Eliav Menachi.  Android custom 2D graphics library  OpenGL ES 1.0 for high performance 3D graphics.
Event Driven (Asynchronous) Programming. Event handling in Unity Subclass a class that contains event handling methods, and then override those methods.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 Event-Driven Programming and Basic GUI Objects.
CSC 205 Programming II Lecture 5 AWT - I.
EEC-693/793 Applied Computer Vision with Depth Cameras
EEC-693/793 Applied Computer Vision with Depth Cameras
Lecture 8: Graphics By: Eliav Menachi.
Miscellaneous Topics #6: Polygons GUI Components and Event Handlers
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
3D-Online Product Configuration by Java3D
Chapter 15 Event-Driven Programming and Animations
Web Design and Development
Events, Event Handlers, and Threads
Lecture 8: Graphics By: Eliav Menachi.
Chapter 15 Event-Driven Programming and Animations Part 1
Presentation transcript:

1 Chapter 10 Behavior and Interaction  To understand dynamic behaviors in graphics  To understand Java 3D Behavior and WakeupCondition classes  To apply Behavior nodes in scene graphs  To use mouse behaviors  To use key navigator behaviors  To use view platform behaviors  To combine picking and behaviors

2 Dynamic 3D Scenes  3D graphics is not limited to static content  There are two common types of dynamic change in a scene –Interaction allows the user to control the changes –Animation generates changes under the control of the program

3 Behavior  Java3D uses behavior to facilitate dynamics in a scene graph  Behavior is a leaf node –Defines actions to be taken when the behavior is activated (waked-up)‏ –Behavior is triggered by wakeup conditions  For interactions, triggers are user generated  For animation, triggers are time-based

4 Behavior Execution Cycles

5 Behavior  During the initialization of the Behavior object, it sets a WakeupCondition object.  When the wakeup condition occurs, it will awaken the Behavior by calling its processStimulus.  After executing the custom code in processStimulus, a wakeup condition can be set again by calling the wakeupOn method.  The process will then repeat indefinitely.

6 Behavior Classes  Behavior –abstract –extends Leaf  Two methods void initialize()‏ void processStimulus ( Enumeration wakeupCriteria)‏

7 WakeupCondition  Serve as signals to trigger different behaviors under different circumstances  WakeupCriterion –Many subclasses for different kinds of triggers  time, AWT events, collisions, transform changes, …  Subclasses that are used to create combinations of conditions

8 Wakeup Condition

9 Combining Wakeup Criteria  Subclasses of WakeupCondition WakeupAnd(WakeupCriterion[] criteria)‏ WakeupOr(WakeupCriterion[] criteria)‏ WakeupOrOfAnds(WakeupAnd[] criteriaAnds)‏ WakeupAndOfOrs(WakeupOr[] criteriaOrs)‏

10 Combining Wakeup Criteria WakeupCriterion[] criteria1 = {new WakeupOnElapsedTime(10000)}; WakeupCriterion[] criteria2 = {new WakeupOnElapsedFrames(5), new WakeupOnCollisionEntry(node)}; WakeupAnd[] ands = {new WakeupAnd( criteria1), new WakeupAnd(criteria2)}; WakeupOrOfAnds condition = new WakeupOrOfAnds( ands);

11 Scheduling Bounds  Each Behavior has a scheduling bounds  Behavior is active only if the scheduling bounds intersects the view platform  Set scheduling bounds with setSchedulingBounds( Bounds bounds)‏ setSchedulingBoundingLeaf( BoundingLeaf bounds)‏

12 Implement Custom Behavior  Define a subclass of Behavior class and override the initialize and processStimulus methods.  Set the appropriate wakeup condition in the initialize method. If necessary set the wakeup condition again in processStimulus.  Create an instance of the custom Behavior class and add it to the scene graph as a leaf.  Set the influence bound for the behavior object.

13 Example: Clock.java

14 Classes for Interaction

11/12/08 Mouse Behavior  Mouse behavior classes –Operate on a TransformGroup –Triggered by WakeUpOnAWTEvent  Three classes for rotation, translation and zoom  Constructors take –TransformGroup –Component –TransformGroup and Component

11/12/08 Mouse Behaviors  MouseRotate: drag the mouse with the left button down.  MouseTranslate: drag the mouse with the right button down.  MouseZoom: drag the mouse with the middle button down –Drag left button down while holding the Alt key if there is no middle mouse button

11/12/08 MoveGlobe.java  Contains a texture-mapped sphere and a set of coordinate axes  Three behaviors for rotation, translation and zoom –All applied to the TransformGroup above the sphere –Axes don't change  Notice the event handling is all hidden inside the Behavior objects

11/12/08 Using Keys for Interaction  KeyNavigationBehavior operates on a TransformGroup  Similar constructors to the mouse behavior

19 KeyNavigatorBehavior , : Rotate left/right , : Translate forward/backward  Alt-, Alt- : Translate left/right  PgUp, PgDn: Rotate up/down  Alt-PgUp, Alt-PgDn: Translate up/down  -: Reduce back clip distance  +: Reset back clip distance  =: Reset

20 View Platform Behavior  OrbitBehavior allows user to interact with the view platform using the mouse –One class supports rotation, translation and zoom –Behavior is applied to the TransformGroup of the view platform  Constructors –OrbitBehavior() –OrbitBehavior(Canvas3D cv) –OrbitBehavior(Canvas3D cv, int flags)

11/12/08 MoveView.java  Similar to MoveGlobe except the view platform is moved rather than the globe itself –Direction of apparent motion is reversed –Axes move too

22 Picking and Mouse Behavior  PickMouseBehavior has three subclasses –PickRotateBehavior –PickTranslateBehavior –PickZoomBehavior  Changes apply only to picked object  Constructor PickRotateBehavior rotator = new PickRotateBehavior(cv, root, bounds); root.addChild(rotator);

11/12/08 TestPickBehavior  Behaviors are applied to the BranchGroup containing the objects  Behaviors need reference to the canvas and the scheduling bounds

11/12/08 Data Visualization  The possibility of interacting with a 3D scene provides a powerful tool for studying 3D data sets –Reorienting the scene gives different views of the data  Improves perception of 3D nature of the data –Ability to select subsets of the data allows refinment of the view

25 DataViewer.java

11/12/08 Using Pick Intersections  Use PickCanvas to pick based on mouse coordinates  All data points are in same 3D object as vertices –need to find the intersection with the pick volume to select individual points PickIntersection inter = results[i].getIntersection(0); Point3d pt = inter.getClosestVertexCoordinates(); int[] ind = inter.getPrimitiveCoordinateIndices();