! See http://factorcode.org/license.txt for BSD license
USING: accessors colors colors.lab colors.luv colors.xyz kernel
-locals math math.constants math.functions math.libm ;
+locals math math.functions math.libm math.trig ;
IN: colors.lch
C: <LCHuv> LCHuv
-<PRIVATE
-
-: deg>rad ( degrees -- radians )
- pi * 180 / ; inline
-
-: rad>deg ( radians -- degrees )
- 180 * pi / ; inline
-
-PRIVATE>
-
M: LCHuv >rgba >luva >rgba ;
M: LCHuv >xyza >luva >xyza ;
! Copyright (C) 2010 Erik Charlebois
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors colors.constants game.loop game.worlds gpu
-gpu.framebuffers gpu.util.wasd game.debug kernel literals locals
-make math math.constants math.matrices math.parser sequences
-alien.c-types specialized-arrays ui.gadgets.worlds ui.pixel-formats ;
+USING: accessors colors.constants game.debug game.loop
+game.worlds gpu gpu.framebuffers gpu.util.wasd kernel literals
+locals make math math.matrices math.parser math.trig sequences
+specialized-arrays ui.gadgets.worlds ui.pixel-formats ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
IN: game.debug.tests
{ default-attachment color }
} clear-framebuffer ;
-: deg>rad ( d -- r )
- 180 / pi * ;
-
:: draw-debug-tests ( world -- )
world [ wasd-p-matrix ] [ wasd-mv-matrix ] bi m. :> mvp-matrix
{ 0 0 0 } clear-screen
! Copyright (c) 2012 Anonymous
! See http://factorcode.org/license.txt for BSD license.
-USING: arrays kernel math math.constants math.functions
+USING: arrays kernel math math.functions math.trig
math.vectors sequences ;
IN: rosetta-code.haversine-formula
: haversininv ( y -- x ) 2 * 1 swap - acos ;
: haversineDist ( as bs -- d )
- [ [ 180 / pi * ] map ] bi@
+ [ [ deg>rad ] map ] bi@
[ [ swap - haversin ] 2map ]
[ [ first cos ] bi@ * 1 swap 2array ]
2bi
! (c)2009 Joe Groff, see BSD license
-USING: accessors arrays assocs fry kernel math math.affine-transforms math.constants
-math.functions math.parser math.vectors memoize peg.ebnf sequences sequences.squish
-splitting strings xml.data xml.syntax ;
+
+USING: accessors arrays assocs fry kernel math
+math.affine-transforms math.functions math.parser math.trig
+peg.ebnf sequences sequences.squish splitting strings xml.data
+xml.syntax ;
+
IN: svg
XML-NS: svg-name http://www.w3.org/2000/svg
[ string>number ] [ [ string>number 10^ ] [ 1 ] if* ] bi* *
>float ;
-: degrees ( deg -- rad ) pi * 180.0 / ;
-
EBNF: svg-transform>affine-transform
transforms =
=> [[ sx sy sx or <scale> ]]
rotate =
"rotate" wsp* "(" wsp* number:a ( comma-wsp number:cx comma-wsp number:cy => [[ cx cy 2array ]])?:c wsp* ")"
- => [[ a degrees <rotation> c [ center-rotation ] when* ]]
+ => [[ a deg>rad <rotation> c [ center-rotation ] when* ]]
skewX =
"skewX" wsp* "(" wsp* number:a wsp* ")"
- => [[ { 1.0 0.0 } a degrees tan 1.0 2array { 0.0 0.0 } <affine-transform> ]]
+ => [[ { 1.0 0.0 } a deg>rad tan 1.0 2array { 0.0 0.0 } <affine-transform> ]]
skewY =
"skewY" wsp* "(" wsp* number:a wsp* ")"
- => [[ 1.0 a degrees tan 2array { 0.0 1.0 } { 0.0 0.0 } <affine-transform> ]]
+ => [[ 1.0 a deg>rad tan 2array { 0.0 1.0 } { 0.0 0.0 } <affine-transform> ]]
number =
sign? (floating-point-constant | integer-constant) => [[ squish-strings svg-string>number ]]
comma-wsp =
! (c)2009 Joe Groff, Doug Coleman. bsd license
USING: accessors arrays combinators game.input game.loop
game.input.scancodes grouping kernel literals locals
-math math.constants math.functions math.order
+math math.constants math.functions math.order math.trig
math.vectors opengl opengl.capabilities opengl.gl
opengl.shaders opengl.textures opengl.textures.private
sequences sequences.product specialized-arrays
[ yaw>> 0.0 1.0 0.0 glRotatef ]
[ location>> vneg first3 glTranslatef ] tri ;
-: degrees ( deg -- rad )
- pi 180.0 / * ; inline
-
TYPED: eye-rotate ( yaw: float pitch: float v: float-4 -- v': float-4 )
- [ float-4{ 0.0 -1.0 0.0 0.0 } swap degrees rotation-matrix4 ]
- [ float-4{ -1.0 0.0 0.0 0.0 } swap degrees rotation-matrix4 m4. ]
+ [ float-4{ 0.0 -1.0 0.0 0.0 } swap deg>rad rotation-matrix4 ]
+ [ float-4{ -1.0 0.0 0.0 0.0 } swap deg>rad rotation-matrix4 m4. ]
[ m4.v ] tri* float-4{ t t t f } vand ;
: forward-vector ( player -- v )