refactor: fix elm-review suggestions

This commit is contained in:
Ananth Venkatesh 2025-02-16 00:22:06 -05:00
parent 595f7ddceb
commit 504c5f860d
Signed by: ananthv
GPG key ID: 4BB578E748CFE4FF
3 changed files with 102 additions and 102 deletions

View file

@ -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",

View file

@ -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/" ]

View file

@ -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,68 +1530,14 @@ 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 =
camera : Camera3d.Camera3d Length.Meters coordinates
camera =
Camera3d.perspective
{ viewpoint =
Viewpoint3d.lookAt
{ focalPoint = Point3d.origin
, eyePoint =
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
@ -1618,14 +1568,68 @@ view3DEntries entry model =
_ ->
7
camera : Camera3d.Camera3d Length.Meters coordinates
camera =
Camera3d.perspective
{ viewpoint =
Viewpoint3d.lookAt
{ focalPoint = Point3d.origin
, eyePoint =
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