Object version of Clipping in Standard.uxf. Needs to be combined with
Generic Clipping instead of Generic Transformation.
Clips the fractal to regular shapes, such as rectangles and circles. It's
quite easy to use in combination with the eyedropper.
Originally written by Damien M. Jones.
class Standard_Clipping(common.ulb:ClipShape) {
;
; Object version of Clipping in Standard.uxf. Needs to be combined with
; Generic Clipping instead of Generic Transformation.
;
; Clips the fractal to regular shapes, such as rectangles and circles. It's
; quite easy to use in combination with the eyedropper.
;
; Originally written by Damien M. Jones.
;
public:
complex func Iterate(complex pz)
complex r
float re
; determine right edge
if @rotation
re = cabs(@sciright-@scicenter)
r = conj(@sciright-@scicenter) / re
else
r = conj(exp(flip(#angle)))
re = abs(real((@sciright-@scicenter)*r))
endif
; determine top edge
float te = abs(imag((@scitop-@scicenter)*r))
; see if point is inside clipping shape
complex p = (pz-@scicenter) * r
if @scishape == "circle"
m_Solid = |p| < sqr(re)
elseif @scishape == "ellipse"
m_Solid = sqr(real(p))/sqr(re)+sqr(imag(p))/sqr(te) < 1.0
elseif @scishape == "square"
m_Solid = abs(real(p)) < re && abs(imag(p)) < re
else ; "rectangle"
m_Solid = abs(real(p)) < re && abs(imag(p)) < te
endif
return pz
endfunc
func SetHandles(Handles phandles)
ClipShape.setHandles(phandles)
phandles.SetHandleCount(3, 0, 0, 0)
phandles.SetHandlePoint(0, 1, -34279628, 0, @scicenter, 0) ; "CENTR"
phandles.SetHandlePoint(1, 1, -72923950, 0, @sciright, 0) ; "RIGHT"
phandles.SetHandlePoint(2, 1, -49026, 0, @scitop, 0) ; "TOP"
endfunc
default:
title = "Clipping"
helpfile = "Uf*.chm"
helptopic = "Html/transformations/standard/clipping.html"
param scicenter
caption = "Center"
default = (0,0)
hint = "Sets the center of clipping."
endparam
param sciright
caption = "Right Edge"
default = (1,0)
hint = "Sets the right edge of the clipping shape. If \
rotation is enabled, sets the center of the \
right edge."
endparam
param scitop
caption = "Top Edge"
default = (0,-1)
hint = "Sets the top edge of the clipping shape. Has no \
effect for Circle and Square clipping shapes."
endparam
param scishape
caption = "Shape"
default = 2
enum = "circle" "ellipse" "square" "rectangle"
hint = "Selects the clipping shape."
endparam
param rotation
caption = "Allow Rotation"
default = false
hint = "If enabled, you can use the Right Edge setting \
to also select a rotation for the clipping shape."
endparam
}