[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line 9c36180ba2 021/195: Enhanced axis documenta
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line 9c36180ba2 021/195: Enhanced axis documentation and new trig function |
Date: |
Wed, 5 Jan 2022 02:59:18 -0500 (EST) |
branch: elpa/telephone-line
commit 9c36180ba2852bf605fff220e9a8ca76797ea7b0
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Enhanced axis documentation and new trig function
---
telephone-line-utils.el | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index fac12947c9..ab6a951435 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -50,12 +50,30 @@
(ceiling (separator-height) 2))
(defun create-axis (length)
- "Create an axis of length LENGTH."
+ "Create an axis of length LENGTH.
+For odd lengths, this is a sequence from -floor(LENGTH/2) to
++floor(LENGTH/2), so for instance a LENGTH of 9 produces:
+
+ -4 -3 -2 -1 0 +1 +2 +3 +4
+
+For even lengths, the 0 is duplicated to preserve symmetry.
+For instance, a LENGTH of 10 produces:
+
+ -4 -3 -2 -1 0 0 +1 +2 +3 +4"
(let ((middle (1- (ceiling length 2))))
(append (number-sequence (- middle) 0)
(number-sequence (if (cl-oddp length) 1 0) middle))))
-(defun normalize-axis (seq)
+(defun create-trig-axis (length)
+ "Create a trig axis with LENGTH steps, ranging from -pi to +pi.
+As with create-axis, on even LENGTHs, the 0 is repeated to
+preserve symmetry."
+ (let* ((integer-axis (create-axis length))
+ (integer-max (seq-max integer-axis)))
+ (mapcar (lambda (x)
+ (/ (* float-pi x) integer-max)))))
+
+(defun -normalize-axis (seq)
"Apply an offset to all values of SEQ such that its range begins at 0."
(let ((minimum (seq-min seq)))
(if (not (eq minimum 0))
@@ -122,7 +140,7 @@ color1 and color2."
(defun create-body (width height axis-func pattern-func)
"Create a bytestring of a PBM image body of dimensions WIDTH and HEIGHT, and
shape created from AXIS-FUNC and PATTERN-FUNC."
- (let* ((normalized-axis (normalize-axis (mapcar axis-func (create-axis
height))))
+ (let* ((normalized-axis (-normalize-axis (mapcar axis-func (create-axis
height))))
(range (1+ (seq-max normalized-axis)))
(scaling-factor (/ width (float range))))
(mapcar (lambda (x)
- [nongnu] elpa/telephone-line 81ec9e3137 171/195: Respect 0/1-indexing setting, (continued)
- [nongnu] elpa/telephone-line 81ec9e3137 171/195: Respect 0/1-indexing setting, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 706cedb353 174/195: Merge pull request #109 from endoffile78/circe, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c0363af166 176/195: Add height to the hash key to automatically handle font size changes, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bc6075462f 185/195: Fix examples for telephone-line-defsegment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line baf17f6f1c 186/195: Fixed parentheses in atom-eol-segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2fbcdb44a9 189/195: Merge pull request #115 from SahilKang/master, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line ff5fcb2181 192/195: Merge pull request #120 from gagbo/patch-3, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line d70907577b 022/195: More formatting., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 97f1935336 005/195: Namespace utils, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 44ca430fe1 062/195: Corrected types for custom vars, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 9c36180ba2 021/195: Enhanced axis documentation and new trig function,
ELPA Syncer <=
- [nongnu] elpa/telephone-line 70c113bea3 063/195: Version Bump, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 797f257642 183/195: Wrap the segment in bound-and-true-p, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 1705f029c7 009/195: Better conform to existing standards, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 5968746a49 137/195: Added option to show window number in unicode., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 6e4e1e648b 151/195: Use built-in faces in flycheck-segment., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 1dc10acfc4 175/195: Apparently this is the only hook that's needed now?, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 356e7b8834 117/195: Update docstring for new axis, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line cdbe1a6be5 140/195: Merge pull request #62 from anandpiyer/master, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 3e73a0ed24 135/195: Add :args and :truncate segment modifiers, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c17c71ae18 132/195: Add missing methods to telephone-line-unicode-separator, ELPA Syncer, 2022/01/05