AKTIVE

rotate.tcl at trunk
Login

rotate.tcl at trunk

File etc/transformer/structure/rotate.tcl artifact 3f3c7e739c on branch trunk


     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
## -*- mode: tcl ; fill-column: 90 -*-
# # ## ### ##### ######## ############# #####################
## Transformers -- Structural changes (data re-arrangements)

# # ## ### ##### ######## ############# #####################
## Highlevel operations implemented on top of the C core
#
## - Rotate in 90 degree increments
## - Arbitrary rotation by affine transform.

operator op::rotate::cw   {
    section transform structure

    example {
	aktive op sdf 2image smooth [aktive op sdf ring [aktive image sdf triangle width 128 height 128 a {10 10} b {50 80} c {80 30}] thickness 4]
	@1
    }

    note Returns image rotating the input 90 degrees clockwise.

    input

    body {
	aktive op flip x [aktive op swap xy $src]
    }
}

operator op::rotate::ccw  {
    section transform structure

    example {
	aktive op sdf 2image smooth [aktive op sdf ring [aktive image sdf triangle width 128 height 128 a {10 10} b {50 80} c {80 30}] thickness 4]
	@1
    }

    note Returns image rotating the input 90 degrees counter clockwise

    input

    body {
	aktive op flip y [aktive op swap xy $src]
    }
}

operator op::rotate::half {
    section transform structure

    example {
	aktive op sdf 2image smooth [aktive op sdf ring [aktive image sdf triangle width 128 height 128 a {10 10} b {50 80} c {80 30}] thickness 4]
	@1
    }

    note Returns image rotating the input 180 degrees (counter) clockwise.

    input

    body {
	aktive op flip x [aktive op flip y $src]
    }
}

operator op::rotate::any   {
    section transform structure

    example {
	dot green {32 32} [sines]
	@1 by 33 around {32 32} | sframe
    }

    note Returns image rotating the input at an arbitrary angle around an arbitrary center. The default center is the image center.

    note This is a convenience operator implemented on top of "<!xref: aktive op transform by>."

    double      by     In degrees, angle to rotate
    point? {{}} around Rotation center. Default is the origin

    str? bilinear interpolate   \[Interpolation method](interpolation.md) to use.

    input

    body {
	aktive op transform by \
	    [aktive transform rotate around $around by $by] \
	    $src \
	    interpolate $interpolate
    }
}

##
# # ## ### ##### ######## ############# #####################
::return