Hans Petter Langtangen 13 gadi atpakaļ
vecāks
revīzija
8cb4ec8faf
3 mainītis faili ar 26 papildinājumiem un 5 dzēšanām
  1. 2 2
      doc/src/sketcher/make.sh
  2. 2 2
      doc/src/sketcher/make_primer.sh
  3. 22 1
      pysketcher/shapes.py

+ 2 - 2
doc/src/sketcher/make.sh

@@ -1,9 +1,9 @@
 #!/bin/sh
 
 # Run spellcheck
-python ~/hg/programs/spellcheck.py -d .dict4spell.txt *.do.txt
+doconce spellcheck -d .dict4spell.txt *.do.txt
 if [ $? -ne 0 ]; then
-  echo "Misspellings!"  # use mydict.txt~.all~ as new dictionary.txt?
+  echo "Abort due to misspellings."
   exit 1
 fi
 

+ 2 - 2
doc/src/sketcher/make_primer.sh

@@ -1,8 +1,8 @@
 #!/bin/sh
 
-python ~/hg/programs/spellcheck.py -d .dict4spell.txt *.do.txt
+doconce spellcheck -d .dict4spell.txt *.do.txt
 if [ $? -ne 0 ]; then
-  echo "Misspellings!"  # use mydict.txt~.all~ as new dictionary.txt?
+  echo "Abort due to misspellings."
   exit 1
 fi
 

+ 22 - 1
pysketcher/shapes.py

@@ -602,7 +602,10 @@ class Spline(Shape):
         return self.smooth(x)
 
 
-class SketchyFunc(Spline):
+class SketchyFunc1(Spline):
+    """
+    A typical function curve used to illustrate an "arbitrary" function.
+    """
     def __init__(self, name=None):
         x = [1, 2,   3,   4, 5,   6]
         y = [5, 3.5, 3.8, 3, 2.5, 2.4]
@@ -612,6 +615,24 @@ class SketchyFunc(Spline):
             self.shapes['name'] = Text(name, self.geometric_features()['start'] + point(0,0.1))
 
 
+class SketchyFunc2(Shape):
+    """
+    A typical function curve used to illustrate an "arbitrary" function.
+    """
+    def __init__(self, name=None):
+        def f(x):
+            return 0.5+x*(2-x)*(0.9-x) # on [0, 2.25]
+
+        a = 0; b = 2.25
+        resolution = 100
+        x = np.linspace(a, b, resolution+1)
+        y = f(x)
+        self.shapes['smooth'] = Curve(x, y)
+        self.shapes['smooth'].set_linecolor('black')
+        if name is not None:
+            self.shapes['name'] = Text(name, point(b, y(b)) + point(0,0.1))
+
+
 class Point(Shape):
     """A point (x,y) which can be rotated, translated, and scaled."""
     def __init__(self, x, y):