Lecture 17a: ACTIVE ZONES of CSG primitives

# Lecture 17a: ACTIVE ZONES of CSG primitives

## Lecture 17a: ACTIVE ZONES of CSG primitives

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Lecture 17a: ACTIVE ZONESof CSG primitives CS1050: Understanding and Constructing Proofs Spring 2006 Jarek Rossignac

2. Lecture Objectives Learn how to • Compute the positive form of a CSG tree • Define the active zone Z of a primitive • Compute a CSG expression of Z • Use the CSG expression for classifying surfels

3.   F   E D A B C What is a CSG tree • Consider a CSG expression: S=(A–B)+(C–D)–(EF) • It may be parsed into a binary tree • Leaves correspond to primitive shapes • Nodes represent Boolean operations • Root represents solid defined by S root primitives

4. A 2D example

5. A shape has many CSG reps

6. When is a primitive redundant A primitive A is redundant in S if S can be expressed using the other primitves, without A.

7. Is A redundant if A adds nothing to S?

8. How to convert a CSG to its positive form? Apply de Morgan laws and push the complement down to the primitives Primitives complemented an odd number of times are negative (and hence unbounded)

9.     E F A B D C What is the positive form of S? S=(A+B)–(C–D)–(EF) S = (A+B) (C–D) (E+F)     F E  B D A C

10. Now assume CSG is in positive form • Rename the negative primitives with new names so that they become positive (although infinite) primitives • A CSG tree in positive form has only union and intersection operators • Hence, in what follows we need not discuss what to do with difference operators • We assume that the CSG tree has been converted into its positive form and that all primitives are positive (even though some may be unbounded)

11.   F E   D A B C What is the path of a primitive A? • The parent and ancestors of A in the CSG tree. Nodes in the path of A root primitives

12.   F E   D A B C How to compute the path? Path will be represented as a string of L or R symbols p=emptyString; path(root,p); path(n,p) { if (n.isPrimitive) { n.myPath=p; else { path(n.left, p+’L’); path(n.right, p+’R’); }; }; L R LL LR RR RL LLR LLL LRR LRL

13.   F E   D A B C What are the branchingnodes? • Siblings of path nodes root Branching nodes of A primitives

14. What are the path and branching nodes of D? Path nodes Branching nodes    F E   D A B C

15.   F E   D A B C What are i-nodes and u-nodes of A? i-nodes = branching nodes that are children of an intersection u-nodes = branching nodes that are children of a union Circle the i-nodes of A? Circle the u-nodes of A?

16.   F E   D A B C Practice i-nodes and u-nodes Circle the i-nodes of C? Circle the u-nodes of C?

17. What is the active zone of A in S? The active zone Z of primitive A in a given CSG expression of S is the region in which changes to A affect S.

18. Simple active zones

19. I = EF   F E   U = B+CD D A B C How are I, U, and Z of A defined? I-zone: I = intersection of the i-nodes (or the universe w if none) U-zone: U = union of the u-nodes Active zone: Z = I – U Compute I, U, and Z for A Z = EF – (B+CD) = EF– B –(CD)

20. I = EF   F E   U = B+CD D A B C Practice: Shade S and Z IDENTIFY S AND Z Verify that changing A out of Z does not change S A B E F C D Z = EF – (B+CD) = EF– B –(CD)

21. Point-in-solid test on CSG Classify(point P, node N) IF N is primitive, THEN RETURN(PMC(P,N)) ELSE RETURN(Combine(N.op, PMC(P,N.left),PMC(P,N.right))); A B    E F F   E D C D A B C

22. Surfel = point E on the boundary of a primitive A. Does it contribute to the boundary of S? Or can A be changed around E without affecting S? How to test a surfel

23. Generate a sufficiently dense set of surfels on the boundary of each primitive A For a cylinder, place surfels on a circle and slide the circle … Classify surfels against Z Render those in Z Strategy for CSG rendering

24. S0 is the solid obtained by replacing A by the empty set in S S1 is the solid obtained by replacing A by the universe in S Definition of S0 and S1

25. Remember that A is positive “” means inclusion or equality Show that S0 S  S1 Adding material to A can only grow S Subtracting material from A can only shrink S

26. Reordering the tree to put A on the left

27. Distributing intersection over union in the reordered tree yields S=AI+X. Setting A to 0 shows that X=S0. Similarly, we can show that S = (A+U)S1since S = (A+B2+B3)(B1+B2+B3)B4 Prove that S = AI+S0 S= (AB1+B2+B3)B4 = AB1 B4 +(B2+B3)B4 = AI+S0

28. S=AI+S0 hence AI  S S=(A+U)S1 hence S (A+U) Show that AI  S  A+U

29. Replace A by the univese (1) in S=AI+S0 Replace A by the empty set (0) in S=(A+U)S1 Show that S1=I+S0 and S0=US1

30. Since S1=I+S0 , S1–S0 = (I+S0)–S0 = I–S0 Since S0=US1 S1–S0 = S1– US1 = S1– U Show that S1–S0 = I–S0 = S1–U

31. S1–S0 = (S1–S0)(S1–S0), since X=XX = (I–S0)(S1–U), proven above = IS0S1U, de Morgan = (IS1)(S0U) , by reordering = (IS1)–(S0+U), de Morgan = I–U, since I  S1 and U  S0 = Z, by definition of Z Prove that Z = S1–S0

32. S = AS1+AS0, Shanon’s expansion = AS1+S0 = AS1 +(AS0 +AS0)+S0 = (AS1+AS0) + (AS0+S0) = A(S1–S0)+S0 = AZ+S0 Show that S=AZ+S0 A S0 S1

33. A Z S0 = A(S1S0)S0 = AS1(S0S0) = 0 Show that AZ and S0 are disjoint

34. Assigned Reading Two papers: • Active Zones in CSG for Accelerating Boundary Evaluation, Redundancy Elimination, Interference Detection and Shading Algorithms • Jarek Rossignac and Herbert Voelcker • ACM Transactions on Graphics, Vol. 8, pp. 51-87, 1989. • Blister: GPU-based rendering of Boolean combinations of free-form triangulated shapes • John Hable and Jarek Rossignac • ACM Transactions on Graphics, SIGGRAPH 2005.

35. Assigned Project P8 • Due April 4 before class • Teams of 1 and 2 • Create a joint web page and put a link to it from the PPPs of each team member • Include in the project: • Project title: 1050 project P8: Active Zones for CSG • Names of the team members • Short description of the assignment • Definition of the active zone and explanation of how it is computed • A short description of how/why it is used in the applet • An example of a CSG expression and of the active zone expression for a primmitive • Reference to the Active Zone paper • Window with a running applet (described in the next slide) • Explanations of the User Interface commands for dragging/chaning primitives • Link to the course code

36. P8 implementation • Start with your P3 assignment with a CSG editor • You will not need it tree editing (but it is nice if you have it) • You need to be able to render a CSG defined region • and to circulate which one is the current primitive • and to move the primitive • Implement a recursive procedure that compute the path to each primitive and stores it with the primitive (you can represent the path as a string of characters or bits). • Let A be the current primitive, Z its active zone, and S0 the region defined by the expression S whith A replaced by the empty set • Render the background in white, S0 in blue, AZ in red, Z–A in green.Remember thatS0 and AZ are disjoint and that their union is S.

37. Showing off the results for P8 • Hardwire your code with an interesting CSG tree and select the default current primitive so that it has at at least 3 branching nodes, two of which being Boolean expression with two or more primtives, with at least one i-node and one u-node. • In the project web page, print the CSG expression, say which primtive is the defailt active primitive, provide the CSG expressions for its I-zone, U-zone, active zone, and S0.