diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fddf9c1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8db8dc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,261 @@ +# OS X +# https://github.com/github/gitignore/blob/master/Global/OSX.gitignore +.DS_Store +.AppleDouble +.LSOverride +._* +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows +# https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +Thumbs.db +ehthumbs.db +Desktop.ini +$RECYCLE.BIN/ +*.lnk + +# Linux +# https://github.com/github/gitignore/blob/master/Global/Linux.gitignore +*~ +.fuse_hidden* +.directory +.Trash-* + +# Archives +# https://github.com/github/gitignore/blob/master/Global/Archives.gitignore +*.7z +*.jar +*.rar +*.zip +*.gz +*.bzip +*.bz2 +*.xz +*.lzma +*.cab +*.iso +*.tar +*.dmg +*.xpi +*.gem +*.egg +*.deb +*.rpm +*.msi +*.msm +*.msp + +# Mono Develop +# https://github.com/github/gitignore/blob/master/Global/MonoDevelop.gitignore +*.userprefs +*.usertasks +*.pidb +*.resources +test-results/ + +# Netbeans +# https://github.com/github/gitignore/blob/master/Global/NetBeans.gitignore +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +.nb-gradle/ + +# Sublime Text +# https://github.com/github/gitignore/blob/master/Global/SublimeText.gitignore +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +sftp-config.json + +# TextMate +# https://github.com/github/gitignore/blob/master/Global/TextMate.gitignore +*.tmproj +*.tmproject +tmtags + +# Vim +# https://github.com/github/gitignore/blob/master/Global/Vim.gitignore +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +Session.vim +.netrwhist + +# Visual Studio Code +# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore +.vscode + +# JetBrains +# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore +.idea/workspace.xml +.idea/tasks.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml +.idea/dataSources.ids +.idea/dataSources.xml +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml +.idea/gradle.xml +.idea/libraries +.idea/mongoSettings.xml +*.iws +/out/ +.idea_modules/ +atlassian-ide-plugin.xml +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Visual Studio +# https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +*.suo +*.user +*.userosscache +*.sln.docstates +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +.vs/ +wwwroot/ +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* +*.VisualState.xml +TestResult.xml +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c +project.lock.json +artifacts/ +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.svclog +*.scc +_Chutzpah* +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.psess +*.vsp +*.vspx +*.sap +$tf/ +*.gpState +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user +.JustCode +_TeamCity* +*.dotCover +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* +*.mm.* +AutoTest.Net/ +[Ee]xpress/ +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html +publish/ +*.[Pp]ublish.xml +*.azurePubxml +*.pubxml +*.publishproj +*.nupkg +**/packages/* +!**/packages/build/ +*.nuget.props +*.nuget.targets +csx/ +*.build.csdef +ecf/ +rcf/ +ApplicationInsights.config +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.[Cc]ache +!*.[Cc]ache/ +ClientBin/ +~$* +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +orleans.codegen.cs +Generated_Code/ +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +*.mdf +*.ldf +*.rdl.data +*.bim.layout +*.bim_*.settings +FakesAssemblies/ +*.GhostDoc.xml +.ntvs_analysis.dat +*.plg +*.opt +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions +.paket/paket.exe +.fake/ +*.sln.iml diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..298469e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,22 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2016 The Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Ray.sln b/Ray.sln new file mode 100755 index 0000000..3901b3a --- /dev/null +++ b/Ray.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{37FC5207-0B3A-48FD-8380-EF172998AE70}") = "Ray", "src\Ray\Ray.xproj", "{9A99BE47-08E1-4A8F-A99C-2931D8950439}" +EndProject +Project("{37FC5207-0B3A-48FD-8380-EF172998AE70}") = "Ray.Test", "test\Ray.Test\Ray.Test.xproj", "{47DA5680-61CC-4138-ABBD-F323BE38F8FE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9A99BE47-08E1-4A8F-A99C-2931D8950439}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A99BE47-08E1-4A8F-A99C-2931D8950439}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A99BE47-08E1-4A8F-A99C-2931D8950439}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A99BE47-08E1-4A8F-A99C-2931D8950439}.Release|Any CPU.Build.0 = Release|Any CPU + {47DA5680-61CC-4138-ABBD-F323BE38F8FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47DA5680-61CC-4138-ABBD-F323BE38F8FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47DA5680-61CC-4138-ABBD-F323BE38F8FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47DA5680-61CC-4138-ABBD-F323BE38F8FE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/global.json b/global.json new file mode 100644 index 0000000..4900848 --- /dev/null +++ b/global.json @@ -0,0 +1,11 @@ +{ + "projects": [ + "lib", + "src", + "test" + ], + "sdk": { + "version": "1.0.0-rc1-update2" + }, + "packages": "packages" +} diff --git a/lib/Point/Point.0.0.0.dll b/lib/Point/Point.0.0.0.dll new file mode 100644 index 0000000..2afca7a Binary files /dev/null and b/lib/Point/Point.0.0.0.dll differ diff --git a/lib/Point/project.json b/lib/Point/project.json new file mode 100644 index 0000000..0694038 --- /dev/null +++ b/lib/Point/project.json @@ -0,0 +1,9 @@ +{ + "frameworks": { + "dnx451": { + "bin": { + "assembly": "Point.0.0.0.dll" + } + } + } +} diff --git a/lib/Vector/Vector.0.0.0.dll b/lib/Vector/Vector.0.0.0.dll new file mode 100644 index 0000000..184b4c3 Binary files /dev/null and b/lib/Vector/Vector.0.0.0.dll differ diff --git a/lib/Vector/project.json b/lib/Vector/project.json new file mode 100644 index 0000000..dfd51ac --- /dev/null +++ b/lib/Vector/project.json @@ -0,0 +1,9 @@ +{ + "frameworks": { + "dnx451": { + "bin": { + "assembly": "Vector.0.0.0.dll" + } + } + } +} diff --git a/src/Ray/Ray.fs b/src/Ray/Ray.fs new file mode 100644 index 0000000..5baca65 --- /dev/null +++ b/src/Ray/Ray.fs @@ -0,0 +1,15 @@ +/// Copyright (C) 2016 The Authors. +module Ray + +open Vector +open Point + +type Ray = R of Point * Vector + +let make p v = + let d = Vector.normalise v + R(p, d) + +let getOrigin (R(p, _)) = p + +let getVector (R(_, d)) = d diff --git a/src/Ray/Ray.fsi b/src/Ray/Ray.fsi new file mode 100644 index 0000000..6575dce --- /dev/null +++ b/src/Ray/Ray.fsi @@ -0,0 +1,13 @@ +/// Copyright (C) 2016 The Authors. +module Ray + +open Vector +open Point + +type Ray + +val make : Point -> Vector -> Ray + +val getOrigin : Ray -> Point + +val getVector : Ray -> Vector diff --git a/src/Ray/Ray.xproj b/src/Ray/Ray.xproj new file mode 100755 index 0000000..3a1753d --- /dev/null +++ b/src/Ray/Ray.xproj @@ -0,0 +1,19 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 9A99BE47-08E1-4A8F-A99C-2931D8950439 + Ray + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + + 2.0 + + + diff --git a/src/Ray/project.json b/src/Ray/project.json new file mode 100644 index 0000000..5ea4d51 --- /dev/null +++ b/src/Ray/project.json @@ -0,0 +1,36 @@ +{ + "version": "0.0.0", + "description": "", + "authors": [ + "Andreas Bjørn Hassing Nielsen " + ], + "tags": [ + ], + "projectUrl": "https://github.itu.dk/bndn/ray", + "licenseUrl": "https://github.itu.dk/bndn/ray/blob/master/LICENSE.md", + + "dependencies": { + "Vector": "", + "Point": "", + "FSharp.Dnx": { + "type": "build", + "version": "1.0.0-*" + } + }, + + "frameworks": { + "dnx451": {} + }, + + "compiler": { + "name": "F#", + "compilerAssembly": "FSharp.Dnx", + "compilerType": "FSharp.Dnx.FSharpProjectCompiler" + }, + "fsharp": { + "files": [ + "Ray.fsi", + "Ray.fs" + ] + } +} diff --git a/test/Ray.Test/Ray.Test.xproj b/test/Ray.Test/Ray.Test.xproj new file mode 100755 index 0000000..827b96e --- /dev/null +++ b/test/Ray.Test/Ray.Test.xproj @@ -0,0 +1,19 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 47DA5680-61CC-4138-ABBD-F323BE38F8FE + Ray.Test + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + + 2.0 + + + diff --git a/test/Ray.Test/RayTest.fs b/test/Ray.Test/RayTest.fs new file mode 100755 index 0000000..95f9c70 --- /dev/null +++ b/test/Ray.Test/RayTest.fs @@ -0,0 +1,14 @@ +/// Copyright (C) 2016 The Authors. +module Ray.Test + +open Xunit +open FsUnit.Xunit + +// TODO: should have some awesome tests here! + +//[] +//let ``make constructs a point given three coordinates`` () = +// let p = Point.make 1.0 2.0 3.0 +// +// // Check that a point was constructed +// p |> should be instanceOfType diff --git a/test/Ray.Test/project.json b/test/Ray.Test/project.json new file mode 100644 index 0000000..41dd474 --- /dev/null +++ b/test/Ray.Test/project.json @@ -0,0 +1,31 @@ +{ + "dependencies": { + "FSharp.Dnx": { + "type": "build", + "version": "1.0.0-*" + }, + "Ray": "", + "Xunit": "2.1.0-*", + "Xunit.Runner.Dnx": "2.1.0-*", + "FsUnit.xUnit": "1.4.1" + }, + + "commands": { + "test": "Xunit.Runner.Dnx" + }, + + "frameworks": { + "dnx451": {} + }, + + "compiler": { + "name": "F#", + "compilerAssembly": "FSharp.Dnx", + "compilerType": "FSharp.Dnx.FSharpProjectCompiler" + }, + "fsharp": { + "files": [ + "RayTest.fs" + ] + } +}