PHLV5 Scheme Example 1

From DocR21

Jump to: navigation, search

This demonstrates the things one can do with Precise Hidden Line Removal V5. The choices over what colors and line styles to use is made by Scheme AIDE, but made possible by the data generated by Precise Hidden Line Removal V5.

(option:set "render_curve_factor" 100)
 
(part:clear)
(define b1 (solid:block -45 -45 -10   45 45 10))
(define b2 (solid:sphere 0 0 0 40))
(bool:unite b1 b2)
(entity:set-color b1 RED)
(entity:set-color (entity:edges b1) BLACK)
(ray:queue 62.2518 -121.886 88.47 -0.408248 0.816497 -0.408248 1)
(entity:set-color (pick-face) YELLOW)
(ray:queue 67.4307 -146.205 34.6522 -0.408248 0.816497 -0.408248 1)
(entity:set-color (pick-face) YELLOW)
 
(view:gl 0 0 300  200)
(view:set-eye (position  204.124145  -408.248291  204.124145))
(view:set-target (position  0  0  0))
(view:set-up (gvector  -0.182574  0.365148  0.912870))
(view:set-size  83  83)
(view:edges #t)
(view:set-bg-color WHITE)
(view:polygonoffset 30) ; make sure that edges are not partially obscured.
(view:refresh)
(system:sleep 3000)
 
(phlv5:compute)
(system:sleep 3000)
 
(view:refresh)
(phlv5:compute 'dashed)
(system:sleep 3000)
 
(view:refresh)
(phlv5:compute  'dotted  'thinner  'dimmer 0.3)
(system:sleep 3000)
Union of a block and a cylinder
This shows the union of a block with a cylinder. The body is colored red, but the two spherical faces are yellow. Edges are colored black.
HLR
The same image with hidden lines removed (HLR). Lines are in red because Scheme AIDE is getting the color from the body, which had a red color attribute attached to it.
HLR with dashed lines
This is the same model but we display the hidden lines as dashes.
HLR with dotted lines
This is the same model but we display the hidden lines as dots. The visible lines are drawn as thicker lines.
HLR perspective
This is the same model but with perspective turned on (view:set-perspective #t).


Other Scheme coding examples of the Scheme command (phlv5:compute):

  • (phlv5:compute)  ; Hidden lines are not displayed
  • (phlv5:compute 'dashed)  ; Hidden lines are dashed (or 'dotted)
  • (phlv5:compute 'thinner)  ; Hidden lines are thinner (visible lines are 3 pixels thick)
  • (phlv5:compute 'thinner 4) ; Hidden lines are thinner by 4 pixels
  • (phlv5:compute 'dimmer)  ; Hidden lines are dimmer (darker by 0.5 in RGB)
  • (phlv5:compute 'dimmer -.3); Hidden lines are dimmer (lighter by -0.3 in RGB)
  • (phlv5:compute (color:rgb .5 .5 .5)) ; Hidden lines are colored grey
  • (phlv5:compute 'outer 7)  ; Outer edges are thicker by 7 pixels (default is 5)
  • (phlv5:compute 'dotted 'thinner 'dimmer 0.3) ; Combination of traits

See Also

Personal tools
Live