HSB and RGB Example

HSB and RGB Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner almost 12 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 660 times • Downloaded 93 times • Run 1 time
Download the 'HSB and RGB Example' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  HSB-as-RGB
  HSB-color
  RGB-color
]

to go
  set HSB-as-RGB hsb hue saturation brightness
  set HSB-color approximate-hsb hue saturation brightness
  ask quadrant -1  1 [ set pcolor HSB-as-RGB ]
  ask quadrant  1  1 [ set pcolor HSB-color ]
  set RGB-color approximate-rgb rgb-red rgb-green rgb-blue
  ask quadrant -1 -1 [ set pcolor (list rgb-red rgb-green rgb-blue) ]
  ask quadrant  1 -1 [ set pcolor RGB-color ]
end 

to-report quadrant [x y]  ;; inputs are 1 or -1
  report patches with [patch-quadrant = list x y]
end 

to-report patch-quadrant  ;; patch procedure
  report list ifelse-value (pxcor < world-width / 2) [-1] [1]
              ifelse-value (pycor < world-width / 2) [-1] [1]
end 


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago HSB and RGB Example Download this version
Uri Wilensky over 14 years ago HSB and RGB Example Download this version

Attached files

File Type Description Last updated
HSB and RGB Example.png preview Preview for 'HSB and RGB Example' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.