refactor: fix elm-review suggestions
This commit is contained in:
parent
595f7ddceb
commit
504c5f860d
3 changed files with 102 additions and 102 deletions
4
elm.json
4
elm.json
|
@ -18,7 +18,6 @@
|
|||
"ianmackenzie/elm-triangular-mesh": "1.1.0",
|
||||
"ianmackenzie/elm-units": "2.10.0",
|
||||
"mdgriffith/elm-ui": "1.1.8",
|
||||
"rl-king/elm-scroll-to": "1.1.2",
|
||||
"w0rm/elm-obj-file": "1.2.1"
|
||||
},
|
||||
"indirect": {
|
||||
|
@ -31,8 +30,7 @@
|
|||
"ianmackenzie/elm-float-extra": "1.1.0",
|
||||
"ianmackenzie/elm-geometry-linear-algebra-interop": "2.0.2",
|
||||
"ianmackenzie/elm-interval": "3.1.0",
|
||||
"ianmackenzie/elm-units-interval": "3.2.0",
|
||||
"tad-lispy/springs": "1.0.5"
|
||||
"ianmackenzie/elm-units-interval": "3.2.0"
|
||||
}
|
||||
},
|
||||
"elm-version": "0.19.1",
|
||||
|
|
|
@ -12,7 +12,6 @@ when inside the directory containing this file.
|
|||
-}
|
||||
|
||||
import Docs.ReviewAtDocs
|
||||
import NoConfusingPrefixOperator
|
||||
import NoDebug.Log
|
||||
import NoDebug.TodoOrToString
|
||||
import NoExposingEverything
|
||||
|
@ -36,7 +35,6 @@ import Simplify
|
|||
config : List Rule
|
||||
config =
|
||||
[ Docs.ReviewAtDocs.rule
|
||||
, NoConfusingPrefixOperator.rule
|
||||
, NoDebug.Log.rule
|
||||
, NoDebug.TodoOrToString.rule
|
||||
|> Rule.ignoreErrorsForDirectories [ "tests/" ]
|
||||
|
|
198
src/Main.elm
198
src/Main.elm
|
@ -1,4 +1,4 @@
|
|||
module Main exposing (Flags, Model, Msg, Object3d, main, sitemap)
|
||||
module Main exposing (Flags, Model, Msg, Object3d, main)
|
||||
|
||||
import Angle
|
||||
import Array
|
||||
|
@ -176,10 +176,6 @@ blender t =
|
|||
n =
|
||||
length mainColors
|
||||
|
||||
p : Float
|
||||
p =
|
||||
frac (t * toFloat n)
|
||||
|
||||
c1 : Maybe ( Float, Float, Float )
|
||||
c1 =
|
||||
getAt (floor (t * toFloat n)) mainColors
|
||||
|
@ -206,6 +202,11 @@ blender t =
|
|||
Color.rgb255 173 111 101
|
||||
|
||||
Just color1 ->
|
||||
let
|
||||
p : Float
|
||||
p =
|
||||
frac (t * toFloat n)
|
||||
in
|
||||
-- blend both colors
|
||||
blend p color1 color2
|
||||
|
||||
|
@ -461,6 +462,7 @@ id =
|
|||
getPaths : String -> List String
|
||||
getPaths base =
|
||||
let
|
||||
root : String
|
||||
root =
|
||||
"/" ++ base
|
||||
in
|
||||
|
@ -470,6 +472,7 @@ getPaths base =
|
|||
itemize : List String -> a -> List ( String, a )
|
||||
itemize multikeys entry =
|
||||
let
|
||||
key : Maybe String
|
||||
key =
|
||||
List.head multikeys
|
||||
in
|
||||
|
@ -493,6 +496,7 @@ sitemap =
|
|||
loadUrl : Model -> List (Html Msg)
|
||||
loadUrl model =
|
||||
let
|
||||
req : Maybe (Model -> List (Html Msg))
|
||||
req =
|
||||
Dict.get model.url.path sitemap
|
||||
in
|
||||
|
@ -1526,98 +1530,6 @@ view3DEntries entry model =
|
|||
else
|
||||
Scene3d.mesh textures (Mesh.texturedFacets mesh)
|
||||
|
||||
height : Float
|
||||
height =
|
||||
case entry of
|
||||
"A" ->
|
||||
10
|
||||
|
||||
"B" ->
|
||||
7
|
||||
|
||||
"C" ->
|
||||
5
|
||||
|
||||
"E" ->
|
||||
1
|
||||
|
||||
_ ->
|
||||
2
|
||||
|
||||
perspective : Angle.Angle
|
||||
perspective =
|
||||
let
|
||||
theta : Float
|
||||
theta =
|
||||
180 * frac (model.angle / 180)
|
||||
|
||||
winding : Float
|
||||
winding =
|
||||
360 * frac (model.angle / 360)
|
||||
|
||||
direction : Float
|
||||
direction =
|
||||
abs (180 - winding) / (180 - winding)
|
||||
|
||||
interp : Float -> Float -> Angle.Angle
|
||||
interp a b =
|
||||
Angle.degrees
|
||||
(if direction > 0 then
|
||||
a + (b - a) * theta / 180
|
||||
|
||||
else
|
||||
b + (a - b) * theta / 180
|
||||
)
|
||||
in
|
||||
case entry of
|
||||
"J" ->
|
||||
interp -45 30
|
||||
|
||||
"E" ->
|
||||
interp 30 110
|
||||
|
||||
"F" ->
|
||||
interp 140 230
|
||||
|
||||
"G" ->
|
||||
interp 230 290
|
||||
|
||||
"H" ->
|
||||
interp 290 315
|
||||
|
||||
_ ->
|
||||
Angle.degrees model.angle
|
||||
|
||||
orbit : Float
|
||||
orbit =
|
||||
case entry of
|
||||
"A" ->
|
||||
4
|
||||
|
||||
"B" ->
|
||||
6
|
||||
|
||||
"C" ->
|
||||
6
|
||||
|
||||
"D" ->
|
||||
10
|
||||
|
||||
"F" ->
|
||||
12
|
||||
|
||||
"G" ->
|
||||
10
|
||||
|
||||
"J" ->
|
||||
12
|
||||
|
||||
"H" ->
|
||||
11
|
||||
|
||||
_ ->
|
||||
7
|
||||
|
||||
camera : Camera3d.Camera3d Length.Meters coordinates
|
||||
camera =
|
||||
Camera3d.perspective
|
||||
|
@ -1626,6 +1538,98 @@ view3DEntries entry model =
|
|||
{ focalPoint = Point3d.origin
|
||||
, eyePoint =
|
||||
let
|
||||
orbit : Float
|
||||
orbit =
|
||||
case entry of
|
||||
"A" ->
|
||||
4
|
||||
|
||||
"B" ->
|
||||
6
|
||||
|
||||
"C" ->
|
||||
6
|
||||
|
||||
"D" ->
|
||||
10
|
||||
|
||||
"F" ->
|
||||
12
|
||||
|
||||
"G" ->
|
||||
10
|
||||
|
||||
"J" ->
|
||||
12
|
||||
|
||||
"H" ->
|
||||
11
|
||||
|
||||
_ ->
|
||||
7
|
||||
|
||||
perspective : Angle.Angle
|
||||
perspective =
|
||||
let
|
||||
phi : Float
|
||||
phi =
|
||||
180 * frac (model.angle / 180)
|
||||
|
||||
winding : Float
|
||||
winding =
|
||||
360 * frac (model.angle / 360)
|
||||
|
||||
direction : Float
|
||||
direction =
|
||||
abs (180 - winding) / (180 - winding)
|
||||
|
||||
interp : Float -> Float -> Angle.Angle
|
||||
interp a b =
|
||||
Angle.degrees
|
||||
(if direction > 0 then
|
||||
a + (b - a) * phi / 180
|
||||
|
||||
else
|
||||
b + (a - b) * phi / 180
|
||||
)
|
||||
in
|
||||
case entry of
|
||||
"J" ->
|
||||
interp -45 30
|
||||
|
||||
"E" ->
|
||||
interp 30 110
|
||||
|
||||
"F" ->
|
||||
interp 140 230
|
||||
|
||||
"G" ->
|
||||
interp 230 290
|
||||
|
||||
"H" ->
|
||||
interp 290 315
|
||||
|
||||
_ ->
|
||||
Angle.degrees model.angle
|
||||
|
||||
height : Float
|
||||
height =
|
||||
case entry of
|
||||
"A" ->
|
||||
10
|
||||
|
||||
"B" ->
|
||||
7
|
||||
|
||||
"C" ->
|
||||
5
|
||||
|
||||
"E" ->
|
||||
1
|
||||
|
||||
_ ->
|
||||
2
|
||||
|
||||
theta : Angle.Angle
|
||||
theta =
|
||||
perspective
|
||||
|
|
Loading…
Reference in a new issue