summary refs log tree commit diff
path: root/pkgs/applications/science/math
diff options
context:
space:
mode:
authorMauricio Collares <mauricio@collares.org>2022-03-13 16:52:51 -0300
committerMauricio Collares <mauricio@collares.org>2022-03-13 16:53:22 -0300
commit5240cbc0d816d12b5bb56789489e4e90ae751172 (patch)
treebef5eed981e8a31a98049cfe56363172a458d169 /pkgs/applications/science/math
parent328bd3c30e4fc4c3d69bc08516f27e8d85f839b6 (diff)
downloadnixpkgs-5240cbc0d816d12b5bb56789489e4e90ae751172.tar
nixpkgs-5240cbc0d816d12b5bb56789489e4e90ae751172.tar.gz
nixpkgs-5240cbc0d816d12b5bb56789489e4e90ae751172.tar.bz2
nixpkgs-5240cbc0d816d12b5bb56789489e4e90ae751172.tar.lz
nixpkgs-5240cbc0d816d12b5bb56789489e4e90ae751172.tar.xz
nixpkgs-5240cbc0d816d12b5bb56789489e4e90ae751172.tar.zst
nixpkgs-5240cbc0d816d12b5bb56789489e4e90ae751172.zip
sage: adapt tachyon interface for 0.99.3
Diffstat (limited to 'pkgs/applications/science/math')
-rw-r--r--pkgs/applications/science/math/sage/patches/tachyon-renamed-focallength.patch81
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix3
2 files changed, 84 insertions, 0 deletions
diff --git a/pkgs/applications/science/math/sage/patches/tachyon-renamed-focallength.patch b/pkgs/applications/science/math/sage/patches/tachyon-renamed-focallength.patch
new file mode 100644
index 00000000000..5fea8830903
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/tachyon-renamed-focallength.patch
@@ -0,0 +1,81 @@
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 3f1dcdb538..b6fa8d1fbd 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -261,13 +261,13 @@ written in the sequence they are listed in the examples in this section.
+   The {\bf PROJECTION} keyword must be followed by one of the supported
+ camera projection mode identifiers {\bf PERSPECTIVE}, {\bf PERSPECTIVE_DOF},
+ {\bf ORTHOGRAPHIC}, or {\bf FISHEYE}.  The {\bf FISHEYE} projection mode
+-requires two extra parameters {\bf FOCALLENGTH} and {\bf APERTURE}
++requires two extra parameters {\bf FOCALDIST} and {\bf APERTURE}
+ which precede the regular camera options.
+ 
+ \begin{verbatim}
+ Camera
+   projection perspective_dof
+-  focallength 0.75
++  focaldist 0.75
+   aperture 0.02
+   Zoom 0.666667
+   Aspectratio 1.000000
+diff --git a/src/sage/plot/plot3d/tachyon.py b/src/sage/plot/plot3d/tachyon.py
+index 08caf38d67..3e827411ce 100644
+--- a/src/sage/plot/plot3d/tachyon.py
++++ b/src/sage/plot/plot3d/tachyon.py
+@@ -92,7 +92,7 @@ angle, right angle)::
+ Finally there is the ``projection='perspective_dof'`` option. ::
+ 
+     sage: T = Tachyon(xres=800, antialiasing=4, raydepth=10,
+-    ....: projection='perspective_dof', focallength='1.0', aperture='.0025')
++    ....: projection='perspective_dof', focaldist='1.0', aperture='.0025')
+     sage: T.light((0,5,7), 1.0, (1,1,1))
+     sage: T.texture('t1', opacity=1, specular=.3)
+     sage: T.texture('t2', opacity=1, specular=.3, color=(0,0,1))
+@@ -186,7 +186,7 @@ class Tachyon(WithEqualityById, SageObject):
+       or ``'fisheye'``.
+     - ``frustum`` - (default ''), otherwise list of four numbers. Only
+       used with projection='fisheye'.
+-    - ``focallength`` - (default ''), otherwise a number. Only used
++    - ``focaldist`` - (default ''), otherwise a number. Only used
+       with projection='perspective_dof'.
+     - ``aperture`` - (default ''), otherwise a number.  Only used
+       with projection='perspective_dof'.
+@@ -331,7 +331,7 @@ class Tachyon(WithEqualityById, SageObject):
+     Use of the ``projection='perspective_dof'`` option.  This may not be
+     implemented correctly. ::
+ 
+-        sage: T = Tachyon(xres=800,antialiasing=4, raydepth=10, projection='perspective_dof', focallength='1.0', aperture='.0025')
++        sage: T = Tachyon(xres=800,antialiasing=4, raydepth=10, projection='perspective_dof', focaldist='1.0', aperture='.0025')
+         sage: T.light((0,5,7), 1.0, (1,1,1))
+         sage: T.texture('t1', opacity=1, specular=.3)
+         sage: T.texture('t2', opacity=1, specular=.3, color=(0,0,1))
+@@ -365,7 +365,7 @@ class Tachyon(WithEqualityById, SageObject):
+                  look_at=[0, 0, 0],
+                  viewdir=None,
+                  projection='PERSPECTIVE',
+-                 focallength='',
++                 focaldist='',
+                  aperture='',
+                  frustum=''):
+         r"""
+@@ -391,7 +391,7 @@ class Tachyon(WithEqualityById, SageObject):
+             self._camera_position = (-3, 0, 0) # default value
+         self._updir = updir
+         self._projection = projection
+-        self._focallength = focallength
++        self._focaldist = focaldist
+         self._aperture = aperture
+         self._frustum = frustum
+         self._objects = []
+@@ -624,9 +624,9 @@ class Tachyon(WithEqualityById, SageObject):
+         camera_out = r"""
+            camera
+               projection %s""" % (tostr(self._projection))
+-        if self._focallength != '':
++        if self._focaldist != '':
+             camera_out = camera_out + r"""
+-              focallength %s""" % (float(self._focallength))
++              focaldist %s""" % (float(self._focaldist))
+         if self._aperture != '':
+             camera_out = camera_out + r"""
+               aperture %s""" % (float(self._aperture))
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index 73a5881d214..bae33802d30 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -155,6 +155,9 @@ stdenv.mkDerivation rec {
       rev = "97d7958bed441cf2ccc714d88f83d3a8426bc085";
       sha256 = "sha256-y1STE0oxswnijGCsBw8eHWWqpmT1XMznIfA0vvX9pFA=";
     })
+
+    # adapted from https://trac.sagemath.org/ticket/23712#comment:22
+    ./patches/tachyon-renamed-focallength.patch
   ];
 
   patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;