-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
flip phillips
committed
Jun 6, 2018
1 parent
8dffd61
commit 7a5d7e8
Showing
18 changed files
with
285 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
*.jpg filter=lfs diff=lfs merge=lfs -text | ||
*.png filter=lfs diff=lfs merge=lfs -text | ||
*.nb filter=lfs diff=lfs merge=lfs -text | ||
*.mx filter=lfs diff=lfs merge=lfs -text | ||
|
||
*.png filter=lfs diff=lfs merge=lfs -text | ||
*.pdf filter=lfs diff=lfs merge=lfs -text | ||
*.ply filter=lfs diff=lfs merge=lfs -text | ||
*.jpg filter=lfs diff=lfs merge=lfs -text | ||
*.psd filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.paclet | ||
.DS_Store | ||
MonitorUtilities/Globals.wl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Buzing's", | ||
"paclet" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"type": "shell", | ||
"command": "/usr/bin/env wolframscript -f build.wls", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "install", | ||
"type": "shell", | ||
"command": "/usr/bin/env wolframscript -f install.wls", | ||
"group": "build" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ Monitor Utilities | |
### Added | ||
|
||
- Development / test stuff | ||
- paclet build | ||
|
||
## [1.0.0] - 2017-11-01 | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
(* ::Package:: *) | ||
|
||
(* display utilities *) | ||
(* uses associations to represent the monitor *) | ||
(* units are cm, degrees, and pixels throughout *) | ||
|
||
|
||
(* Implementation of the package *) | ||
|
||
|
||
(* ::Text:: *) | ||
(*We'll just do this in x axis for now... but should be better than all that*) | ||
|
||
|
||
PixelsPerCM[mon_]:=mon["xres"]/mon["xsize"] | ||
|
||
|
||
CMPerPixel[mon_]:=1/PixelsPerCM[mon] | ||
|
||
|
||
DegreesPerCM[distance_,length_:1.0]:=ArcTan[distance,length]/Degree | ||
|
||
|
||
CMPerDegree[distance_,length_:1.0]:=1/DegreesPerCM[distance,length] | ||
|
||
|
||
DegreesPerPixel[mon_,vp_]:=DegreesPerCM[vp]/PixelsPerCM[mon] | ||
|
||
|
||
DegreesPerPixel[mon_]:=DegreesPerCM[mon["distance"]]/PixelsPerCM[mon] | ||
|
||
|
||
PixelsPerDegree[mon_,vp_]:=1/DegreesPerPixel[mon,vp] | ||
|
||
|
||
PixelsPerDegree[mon_]:=1/DegreesPerPixel[mon,mon["distance"]] | ||
|
||
|
||
(* this shit makes me crazy *) | ||
|
||
|
||
CartesianToMonitor[mon_,p_]:={p[[1]],mon["yres"]-p[[2]]} | ||
|
||
|
||
(* row,col *) | ||
|
||
|
||
MonitorToImage[mon_,p_]:={mon["yres"]-p[[2]],p[[1]]} | ||
|
||
|
||
(* Note this is POSITION not size!!! y inverted! Screen space *) | ||
|
||
|
||
MonitorToDegrees[mon_,p_]:=(CartesianToMonitor[mon,p]-{mon["xres"],mon["yres"]}/2)/PixelsPerDegree[mon] | ||
|
||
|
||
DegreesToMonitor[mon_,va_]:=CartesianToMonitor[mon,(va*PixelsPerDegree[mon])+({mon["xres"],mon["yres"]}/2)] |
3 changes: 3 additions & 0 deletions
3
MonitorUtilities/Documentation/English/Guides/MonitorUtilities.nb
Git LFS file not shown
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(* As borrowed from Arnoud's templates *) | ||
|
||
PrintTemporary["Loading ",ToString[Length[Names["MonitorUtilities`*"]]], " MonitorUtilities functions"]; | ||
|
||
BeginPackage["MonitorUtilities`",{"PacletManager`"}]; | ||
|
||
Get[FileNameJoin[{DirectoryName[$InputFileName],"Usage.wl"}]]; | ||
|
||
Begin["`Private`"]; | ||
|
||
Module[{files}, | ||
|
||
(* load in any session *) | ||
files={"Globals.wl","Conversions.wl"}; | ||
|
||
Map[Get[FileNameJoin[{DirectoryName[$InputFileName], #}]] &, files]; | ||
|
||
(* only load in a notebook session *) | ||
(* | ||
If[ Head[$FrontEnd] === FrontEndObject, | ||
files = {"Dock.wl","Notebook.wl"}; | ||
Map[ Get[ FileNameJoin[{DirectoryName[$InputFileName], #}] ] &, files ]; | ||
] | ||
*) | ||
|
||
]; | ||
|
||
End[]; | ||
EndPackage[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Paclet[ | ||
Name -> "MonitorUtilities", | ||
Description -> "Tools for monitor / viewing calculations", | ||
Creator -> "Flip Phillips <[email protected]>", | ||
Publisher -> "Skidmore Vision Lab", | ||
Copyright -> "1997- Flip Phillips", | ||
License -> "MIT", | ||
Version -> "1.2.0", | ||
BuildNumber -> "17", | ||
MathematicaVersion -> "11.2+", | ||
URL -> "https://github.com/flipphillips/MonitorUtilities", | ||
Thumbnail -> "Documentation/icon.png", | ||
Loading -> Automatic, | ||
Extensions -> { | ||
{ "Documentation", | ||
MainPage -> "Guides/MonitorUtilities", | ||
Language -> "English"}, | ||
{ "Kernel", | ||
Symbols -> { | ||
(* globals *) | ||
"MonitorUtilities`$MonitorUtilitiesVersion","MonitorUtilities`$MonitorUtilitiesDebug", | ||
|
||
"MonitorUtilities`PixelsPerCM", | ||
"MonitorUtilities`CMPerPixel", | ||
"MonitorUtilities`DegreesPerCM", | ||
"MonitorUtilities`CMPerDegree", | ||
"MonitorUtilities`DegreesPerPixel", | ||
"MonitorUtilities`PixelsPerDegree", | ||
"MonitorUtilities`CartesianToMonitor", | ||
"MonitorUtilities`MonitorToImage", | ||
"MonitorUtilities`MonitorToDegrees", | ||
"MonitorUtilities`DegreesToMonitor" | ||
}, | ||
Context -> {"MonitorUtilities`"} } | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(* ::Package:: *) | ||
|
||
|
||
(* ::Section:: *) | ||
(*Automatically Generated*) | ||
|
||
|
||
$MonitorUtilitiesVersion::usage = "$MonitorUtilitiesVersion gives its best guess as to the version we're using."; | ||
$MonitorUtilitiesDebug::usage = "$MonitorUtilitiesDebug let's us know if the package was built with any debugging tools."; | ||
|
||
|
||
(* MonitorUtilities::usage="A package for doing monitor computation. Needs an association with xres,yres,xsize,ysize, and distance defined." *) | ||
|
||
|
||
PixelsPerCM::usage="PixelsPerCM[mon] returns pixels per centimeter for the given mon." | ||
CMPerPixel::usage="CMPerPixel[mon] returns centimeters per pixel for mon." | ||
|
||
|
||
DegreesPerCM::usage="DegreesPerCM[distance] gives the degrees per 1 centimeter at a particular distance. Optionally, DegreesPerCM[distance,length] allows specification of the length on the screen." | ||
CMPerDegree::usage="CMPerDegree[distance] gives the centimeters, on the screen." | ||
|
||
|
||
DegreesPerPixel::usage="DegreesPerPixel[mon] gives the given degrees per pixel for monitor mon. DegreesPerPixel[mon,vp] at viewpoint vp." | ||
PixelsPerDegree::usage="PixelsPerDegree[mon] or PixelsPerDegree[mon,vp]" | ||
|
||
|
||
CartesianToMonitor::usage="CartesianToMonitor[mon,p] projects p onto monitor space." | ||
MonitorToImage::usage="MonitorToImage[mon,p] projects monitor position to image space {row,col} style." | ||
MonitorToDegrees::usage="MonitorToDegrees[mon,p] projects monitor position degrees." | ||
DegreesToMonitor::usage="DegreesToMonitor[mon,va] projects a point at va to monitor space." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env wolframscript | ||
# | ||
# paclet builder | ||
# | ||
|
||
(* gerbils *) | ||
$packageName="MonitorUtilities"; | ||
$versionFile="version.json"; | ||
$globalsFile="Globals.wl"; | ||
|
||
directory = Directory[]; | ||
pacletDirectory = FileNameJoin[{directory, $packageName}]; | ||
|
||
Print["Building from: ", directory]; | ||
|
||
(* bump build *) | ||
VersionBumpBuild[directory]; | ||
|
||
(* globals *) | ||
Unprotect[{$MonitorUtilitiesDebug,$MonitorUtilitiesVersion}] | ||
$MonitorUtilitiesDebug=False; | ||
$MonitorUtilitiesVersion=VersionString[directory,"Build"->True]; | ||
|
||
(* create global file *) | ||
gfile=FileNameJoin[{directory,$packageName,$globalsFile}]; | ||
If[FileExistsQ[gfile], DeleteFile[gfile]]; | ||
Save[gfile, {$MonitorUtilitiesDebug, $MonitorUtilitiesVersion}]; | ||
|
||
(* delete old paclet *) | ||
files = FileNames["*.paclet", directory]; | ||
Print["Found paclets (to be deleted): ", files]; | ||
DeleteFile /@ files; | ||
|
||
(* build new paclet *) | ||
Print["Building new paclet"]; | ||
UpdatePacletFile[pacletDirectory,directory]; | ||
paclet = PackPaclet[pacletDirectory]; | ||
Print["New paclet: ", paclet]; | ||
|
||
paclets = PacletFind[$packageName]; | ||
Print["Found the following old paclets (uninstalling): ", Map[ #["Location"]&, paclets]]; | ||
Map[ PacletUninstall, paclets ]; | ||
|
||
|
||
(* install new paclet *) | ||
Print["Installing new paclet"] | ||
PacletInstall[paclet, IgnoreVersion -> True]; | ||
|
||
(* Build wiki docs *) | ||
wikidir=FileNameJoin[{"..",$packageName<>".wiki"}]; | ||
|
||
Print["Building wiki at ",wikidir] | ||
BuildWikiDocumentation[wikidir,$packageName]; | ||
|
||
Print["Done"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env wolframscript | ||
# | ||
# paclet installer | ||
# | ||
|
||
(* gerbils *) | ||
$packageName="MonitorUtilities"; | ||
$versionFile="version.json"; | ||
$globalsFile="Globals.wl"; | ||
|
||
directory = Directory[]; | ||
pacletDirectory = FileNameJoin[{directory, $packageName}]; | ||
|
||
Print["Installing from: ", directory]; | ||
|
||
paclets = PacletFind[$packageName]; | ||
Print["Found the following old paclets (uninstalling): ", Map[ #["Location"]&, paclets]]; | ||
Map[ PacletUninstall, paclets ]; | ||
|
||
(* install new paclet *) | ||
Print["Installing new paclet"] | ||
PacletInstall[FileNames["*.paclet", directory], IgnoreVersion -> True]; | ||
|
||
Print["Done"] |
Oops, something went wrong.