/usr/share/doc/libghc-diagrams-lib-doc/html/src/Diagrams-ThreeD-Align.html is in libghc-diagrams-lib-doc 1.3.1.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/Diagrams/ThreeD/Align.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>{-# LANGUAGE TypeFamilies #-}</span>
<a name="line-2"></a>
<a name="line-3"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-4"></a><span class='hs-comment'>-- |</span>
<a name="line-5"></a><span class='hs-comment'>-- Module : Diagrams.ThreeD.Align</span>
<a name="line-6"></a><span class='hs-comment'>-- Copyright : (c) 2013 diagrams-lib team (see LICENSE)</span>
<a name="line-7"></a><span class='hs-comment'>-- License : BSD-style (see LICENSE)</span>
<a name="line-8"></a><span class='hs-comment'>-- Maintainer : diagrams-discuss@googlegroups.com</span>
<a name="line-9"></a><span class='hs-comment'>--</span>
<a name="line-10"></a><span class='hs-comment'>-- Alignment combinators specialized for three dimensions. See</span>
<a name="line-11"></a><span class='hs-comment'>-- "Diagrams.Align" for more general alignment combinators.</span>
<a name="line-12"></a><span class='hs-comment'>--</span>
<a name="line-13"></a><span class='hs-comment'>-- The basic idea is that alignment is achieved by moving diagrams'</span>
<a name="line-14"></a><span class='hs-comment'>-- local origins relative to their envelopes or traces (or some other</span>
<a name="line-15"></a><span class='hs-comment'>-- sort of boundary). For example, to align several diagrams along</span>
<a name="line-16"></a><span class='hs-comment'>-- their tops, we first move their local origins to the upper edge of</span>
<a name="line-17"></a><span class='hs-comment'>-- their boundary (using e.g. @map 'alignZMax'@), and then put them</span>
<a name="line-18"></a><span class='hs-comment'>-- together with their local origins along a line (using e.g. 'cat'</span>
<a name="line-19"></a><span class='hs-comment'>-- from "Diagrams.Combinators").</span>
<a name="line-20"></a><span class='hs-comment'>--</span>
<a name="line-21"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-22"></a>
<a name="line-23"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>ThreeD</span><span class='hs-varop'>.</span><span class='hs-conid'>Align</span>
<a name="line-24"></a> <span class='hs-layout'>(</span> <span class='hs-comment'>-- * Absolute alignment</span>
<a name="line-25"></a> <span class='hs-comment'>-- ** Align by envelope</span>
<a name="line-26"></a> <span class='hs-varid'>alignXMin</span><span class='hs-layout'>,</span> <span class='hs-varid'>alignXMax</span><span class='hs-layout'>,</span> <span class='hs-varid'>alignYMin</span><span class='hs-layout'>,</span> <span class='hs-varid'>alignYMax</span><span class='hs-layout'>,</span> <span class='hs-varid'>alignZMin</span><span class='hs-layout'>,</span> <span class='hs-varid'>alignZMax</span>
<a name="line-27"></a>
<a name="line-28"></a> <span class='hs-comment'>-- ** Align by trace</span>
<a name="line-29"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>snugXMin</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugXMax</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugYMin</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugYMax</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugZMin</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugZMax</span>
<a name="line-30"></a>
<a name="line-31"></a> <span class='hs-comment'>-- * Relative alignment</span>
<a name="line-32"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>alignX</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugX</span><span class='hs-layout'>,</span> <span class='hs-varid'>alignY</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugY</span><span class='hs-layout'>,</span> <span class='hs-varid'>alignZ</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugZ</span>
<a name="line-33"></a>
<a name="line-34"></a> <span class='hs-comment'>-- * Centering</span>
<a name="line-35"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>centerX</span><span class='hs-layout'>,</span> <span class='hs-varid'>centerY</span><span class='hs-layout'>,</span> <span class='hs-varid'>centerZ</span>
<a name="line-36"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>centerXY</span><span class='hs-layout'>,</span> <span class='hs-varid'>centerXZ</span><span class='hs-layout'>,</span> <span class='hs-varid'>centerYZ</span><span class='hs-layout'>,</span> <span class='hs-varid'>centerXYZ</span>
<a name="line-37"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>snugCenterX</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugCenterY</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugCenterZ</span>
<a name="line-38"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>snugCenterXY</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugCenterXZ</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugCenterYZ</span><span class='hs-layout'>,</span> <span class='hs-varid'>snugCenterXYZ</span>
<a name="line-39"></a>
<a name="line-40"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-41"></a>
<a name="line-42"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span>
<a name="line-43"></a>
<a name="line-44"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>Align</span>
<a name="line-45"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>ThreeD</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
<a name="line-46"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>ThreeD</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span>
<a name="line-47"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>TwoD</span><span class='hs-varop'>.</span><span class='hs-conid'>Align</span>
<a name="line-48"></a>
<a name="line-49"></a><a name="alignXMin"></a><span class='hs-comment'>-- | Translate the diagram along unitX so that all points have</span>
<a name="line-50"></a><span class='hs-comment'>-- positive x-values.</span>
<a name="line-51"></a><span class='hs-definition'>alignXMin</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R1</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-52"></a><span class='hs-definition'>alignXMin</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>align</span> <span class='hs-varid'>unit_X</span>
<a name="line-53"></a>
<a name="line-54"></a><a name="snugXMin"></a><span class='hs-definition'>snugXMin</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R1</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-55"></a><span class='hs-definition'>snugXMin</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snug</span> <span class='hs-varid'>unit_X</span>
<a name="line-56"></a>
<a name="line-57"></a><a name="alignXMax"></a><span class='hs-comment'>-- | Translate the diagram along unitX so that all points have</span>
<a name="line-58"></a><span class='hs-comment'>-- negative x-values.</span>
<a name="line-59"></a><span class='hs-definition'>alignXMax</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R1</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-60"></a><span class='hs-definition'>alignXMax</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>align</span> <span class='hs-varid'>unitX</span>
<a name="line-61"></a>
<a name="line-62"></a><a name="snugXMax"></a><span class='hs-definition'>snugXMax</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R1</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-63"></a><span class='hs-definition'>snugXMax</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snug</span> <span class='hs-varid'>unitX</span>
<a name="line-64"></a>
<a name="line-65"></a>
<a name="line-66"></a><a name="alignYMin"></a><span class='hs-comment'>-- | Translate the diagram along unitY so that all points have</span>
<a name="line-67"></a><span class='hs-comment'>-- positive y-values.</span>
<a name="line-68"></a><span class='hs-definition'>alignYMin</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R2</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-69"></a><span class='hs-definition'>alignYMin</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>align</span> <span class='hs-varid'>unit_Y</span>
<a name="line-70"></a>
<a name="line-71"></a><a name="snugYMin"></a><span class='hs-definition'>snugYMin</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R2</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-72"></a><span class='hs-definition'>snugYMin</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snug</span> <span class='hs-varid'>unit_Y</span>
<a name="line-73"></a>
<a name="line-74"></a><a name="alignYMax"></a><span class='hs-comment'>-- | Translate the diagram along unitY so that all points have</span>
<a name="line-75"></a><span class='hs-comment'>-- negative y-values.</span>
<a name="line-76"></a><span class='hs-definition'>alignYMax</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R2</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-77"></a><span class='hs-definition'>alignYMax</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>align</span> <span class='hs-varid'>unitY</span>
<a name="line-78"></a>
<a name="line-79"></a><a name="snugYMax"></a><span class='hs-definition'>snugYMax</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R2</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-80"></a><span class='hs-definition'>snugYMax</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snug</span> <span class='hs-varid'>unitY</span>
<a name="line-81"></a>
<a name="line-82"></a>
<a name="line-83"></a><a name="alignZMin"></a><span class='hs-comment'>-- | Translate the diagram along unitZ so that all points have</span>
<a name="line-84"></a><span class='hs-comment'>-- positive z-values.</span>
<a name="line-85"></a><span class='hs-definition'>alignZMin</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-86"></a><span class='hs-definition'>alignZMin</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>align</span> <span class='hs-varid'>unit_Z</span>
<a name="line-87"></a>
<a name="line-88"></a><a name="snugZMin"></a><span class='hs-definition'>snugZMin</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-89"></a><span class='hs-definition'>snugZMin</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snug</span> <span class='hs-varid'>unit_Z</span>
<a name="line-90"></a>
<a name="line-91"></a><a name="alignZMax"></a><span class='hs-comment'>-- | Translate the diagram along unitZ so that all points have</span>
<a name="line-92"></a><span class='hs-comment'>-- negative z-values.</span>
<a name="line-93"></a><span class='hs-definition'>alignZMax</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-94"></a><span class='hs-definition'>alignZMax</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>align</span> <span class='hs-varid'>unitZ</span>
<a name="line-95"></a>
<a name="line-96"></a><a name="snugZMax"></a><span class='hs-definition'>snugZMax</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-97"></a><span class='hs-definition'>snugZMax</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snug</span> <span class='hs-varid'>unitZ</span>
<a name="line-98"></a>
<a name="line-99"></a><a name="alignZ"></a><span class='hs-comment'>-- | Like 'alignX', but moving the local origin in the Z direction, with an</span>
<a name="line-100"></a><span class='hs-comment'>-- argument of @1@ corresponding to the top edge and @(-1)@ corresponding</span>
<a name="line-101"></a><span class='hs-comment'>-- to the bottom edge.</span>
<a name="line-102"></a><span class='hs-definition'>alignZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-103"></a><span class='hs-definition'>alignZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>alignBy</span> <span class='hs-varid'>unitZ</span>
<a name="line-104"></a>
<a name="line-105"></a><a name="snugZ"></a><span class='hs-comment'>-- | See the documentation for 'alignZ'.</span>
<a name="line-106"></a><span class='hs-definition'>snugZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>V</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>~</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>N</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>~</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span>
<a name="line-107"></a> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-108"></a><span class='hs-definition'>snugZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snugBy</span> <span class='hs-varid'>unitZ</span>
<a name="line-109"></a>
<a name="line-110"></a>
<a name="line-111"></a><a name="centerZ"></a><span class='hs-comment'>-- | Center the local origin along the Z-axis.</span>
<a name="line-112"></a><span class='hs-definition'>centerZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-113"></a><span class='hs-definition'>centerZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>alignBy</span> <span class='hs-varid'>unitZ</span> <span class='hs-num'>0</span>
<a name="line-114"></a>
<a name="line-115"></a><a name="snugCenterZ"></a><span class='hs-definition'>snugCenterZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-116"></a><span class='hs-definition'>snugCenterZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snugBy</span> <span class='hs-varid'>unitZ</span> <span class='hs-num'>0</span>
<a name="line-117"></a>
<a name="line-118"></a><a name="centerXZ"></a><span class='hs-comment'>-- | Center along both the X- and Z-axes.</span>
<a name="line-119"></a><span class='hs-definition'>centerXZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-120"></a><span class='hs-definition'>centerXZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>centerX</span> <span class='hs-varop'>.</span> <span class='hs-varid'>centerZ</span>
<a name="line-121"></a>
<a name="line-122"></a><a name="snugCenterXZ"></a><span class='hs-definition'>snugCenterXZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-123"></a><span class='hs-definition'>snugCenterXZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snugCenterX</span> <span class='hs-varop'>.</span> <span class='hs-varid'>snugCenterZ</span>
<a name="line-124"></a>
<a name="line-125"></a>
<a name="line-126"></a><a name="centerYZ"></a><span class='hs-comment'>-- | Center along both the Y- and Z-axes.</span>
<a name="line-127"></a><span class='hs-definition'>centerYZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-128"></a><span class='hs-definition'>centerYZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>centerZ</span> <span class='hs-varop'>.</span> <span class='hs-varid'>centerY</span>
<a name="line-129"></a>
<a name="line-130"></a><a name="snugCenterYZ"></a><span class='hs-definition'>snugCenterYZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-131"></a><span class='hs-definition'>snugCenterYZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snugCenterZ</span> <span class='hs-varop'>.</span> <span class='hs-varid'>snugCenterY</span>
<a name="line-132"></a>
<a name="line-133"></a><a name="centerXYZ"></a><span class='hs-comment'>-- | Center an object in three dimensions.</span>
<a name="line-134"></a><span class='hs-definition'>centerXYZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-135"></a><span class='hs-definition'>centerXYZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>centerX</span> <span class='hs-varop'>.</span> <span class='hs-varid'>centerY</span> <span class='hs-varop'>.</span> <span class='hs-varid'>centerZ</span>
<a name="line-136"></a>
<a name="line-137"></a><a name="snugCenterXYZ"></a><span class='hs-definition'>snugCenterXYZ</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>InSpace</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>R3</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Alignable</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasOrigin</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-138"></a><span class='hs-definition'>snugCenterXYZ</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snugCenterX</span> <span class='hs-varop'>.</span> <span class='hs-varid'>snugCenterY</span> <span class='hs-varop'>.</span> <span class='hs-varid'>snugCenterZ</span>
</pre></body>
</html>
|