<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/pattern.xsl"?>
<pattern id="">
  <name>Projection</name>
  <relatedPatterns>
    <relatedPattern ref="">
      <patternLink>Mapping</patternLink>
    </relatedPattern>
    <relatedPattern ref="">
      <patternLink>Organized Collection of Points</patternLink>
    </relatedPattern>
  </relatedPatterns>
  <!-- The diagram is a graphic representation of the pattern.-->
  <diagram>
  <web>
    <img src = "AlexandreDuret-LutzParcDeLaVillette-sm.jpg" width="400" />
	</web>
	  <latex>
    <img src = "AlexandreDuret-LutzParcDeLaVillette-sm.jpg" width="400" />
	</latex>
    <web>Credit: Alexandre Duret-Lutz <a href="http://creativecommons.org/licenses/by-sa/2.0/" title="Licensed under Creative Commons."><img src="http://creativecommons.org/images/public/somerights20.gif" alt="There is a Creative Commons license attached to this image." style="border: none;" width="88" height="31" /></a></web>
  </diagram>
    <latex>
      \sourceLocated{Alexandre Duret-Lutz. Creative Commons Attribution Share-alike.}
    </latex>
  <what>
    <paragraph>
      Produce a transformation of an object in another geometric context.
    </paragraph>
  </what>
  <when>
    <paragraph>
      "Here" and "there" pervade design. Eyes, ears, the sun, lights, structural
      elements, ducts and pipes all relate a "here" to some distant
      "there". Often the relationship between here and there is a geometric line
      or curve. Use this pattern to construct coherent, reproducible
      relationships between "here" and "there."
    </paragraph>
  </when>
  <why>
    <paragraph>
      Projection<latex>\index{transformation!projection|(}</latex> provides a conceptually simple, yet openended tool for
      producing new objects from old. Its origins lie in the Renaissance and
      before. For designers, projection is perhaps most associated with the
      field of <em>descriptive geometry</em>, an 18th Century invention
      <latex>\cite{MONGE1827}</latex> and one which, until recently,
      was a mandatory part of design curricula worldwide. Descriptive geometry
      codified procedures for deriving two dimensional representations of three
      dimension objects by projecting the three dimensional objects onto
      surfaces. Parametric modeling supports a much richer collection of
      projective ideas than was practical with older, manual techniques. With
      tongue somewhat in cheek, one could argue that parametric modeling is the
      21st Century replacement for descriptive geometry.

      The basic idea of projection has three parts: (1) a <em>source
      object</em> to be projected, (2) a <em>projector</em> or
      <em>projection method</em>, and (3) a <em>receiver,</em> the
      object on which the projection appears. Its most simple form is
      orthogonal projection: points are projected onto a receiving
      plane such that the projection lines are perpendicular to the
      plane. The suite of projection and intersection tools available
      in parametric modeling enable a wide range of projective
      form-making ideas.

      The two main effects of projection are indirection and
      separation. With it, a model can be the indirect cause of a
      sculptural effect. With it, different aspects of an object can
      be separated into distinct views that may enable special views
      and inferences on the object. A very common example is a light
      (essentially a point source) that <em>projects</em> a pattern
      through a screen onto a surface.
    </paragraph>
  </why>
  <how>
    <paragraph>
      Every <patternName>Projection</patternName> has the three parts
      mentioned above: (1) the projected object, (2) the projection
      method and (3) the receiving object. The projected object is a
      point or any composite of points: a line, ray, line segment,
      curve, polygon, surface, or <math latex="3D">3D</math>
      object. The three most common projection methods are
      <em>parallel projection</em> in which all projecting ray are
      parallel; <em>normal projection</em> in which the projecting
      rays are normal to the receiving object; and <em>perspective
      projection</em> in which all projecting rays pass through a
      single point. There are a wide range of other methods. For
      instance, cartographic projections can be explained as the
      mapping of parametric coordinates from one surface to
      another. The most common receiving ojects are planes, polygons,
      surfaces, lines and curves, as well as composites of
      these. While possible, projections to points and <math
      latex="3D">3D</math> objects seem to be less common in practice.
    </paragraph>
    <paragraph>
      <latex>A wide variety of projections exist
      \cite{CSISS2009}.</latex> Computing projections involves either
      mathematical projection or intersection. Mathematical projection
      provides direct solutions to relatively simple situations such
      as projecting one vector <math latex="\afVrF{u}">u</math> onto
      another vector <math latex="\afVrF{v}">v</math> with result
      <math latex="\afVrF{w} =
      \frac{\cgDot{\afVrF{u}}{\afVrF{v}}}{\afNorm{\afVrF{v}}}\afVrF{v}">
      w=((u.v)/|v|)v</math>. More complex situations involve
      intersecting objects. For example, projecting a point onto a
      surface amounts to computing the intersection between the
      surface and projecting ray.
    </paragraph>
    <paragraph>
      In many simple cases, a parametric modeler will provide direct tools for
      computing projections, for instance, projecting a line onto a plane. It is
      a fact of life though that designers will push these bounds. In these more
      complex situations, using the <patternName>Projection</patternName>
      pattern involves three steps: (1) sampling key object points, (2)
      projecting these points onto the receiver, and (3) reconstructing the
      object as projected on the receiver. 
    </paragraph>
    <web>
    <diagram>
      <img src="ImgProjC.png" width="500"/>
    </diagram>
    </web>
  </how>
  <samples>
    <sample id="SurfaceSampler">
      <name>Surface Sampler</name>
      <web>
	<diagram>
	  <img src="ImgProjC.png" width="500"/>
	</diagram>
      </web>
      <when>
	<paragraph> 
	  Project a collection of points onto a surface.
	</paragraph>
      </when>
      <how>
	<paragraph>
	  The mathematical tools for describing surfaces tie the shape of the
	  surface and its <math latex="uv">uv</math>-parameterization to the
	  control polygon. Often, only part of the surface is actually needed in
	  a design. Projecting an <patternLink>Organized Collection of
	  Points</patternLink> onto the surface<latex>\index{surface}</latex> provides a subset of the surface
	  with its own independent parameterization. 
	</paragraph>
	<paragraph>
	  The source object is a point<latex>\index{point}</latex> collection. In this sample, the
	  collection lies on a plane and is a simple array, but other geometric
	  and data arrangements can be used. The projector is parallel
	  projection, with projecting rays being parallel to a line from the
	  centroid of the collection to a controlling point in
	  space. Alternatively, the projector could be a perpendicular line<latex>\index{line}</latex> from
	  the source plane and a control could allow the source to be moved
	  within its plane. The receiver is the surface. 
	</paragraph>
      </how>
      <a href="Samples/ProjSurfaceSampler/ProjSurfaceSampler.gct" >Download ProjSurfaceSampler.gct</a>
      <animation src="Samples/ProjSurfaceSampler/AnimationSurfaceSampler.swf"/>
    </sample>
	<latex>\renewcommand{\sampleNewPage}[0]{false}</latex>
    <sample id="Shadows">
      <name>Shadows</name>
      <when>
	<paragraph> Simulate a row of posts casting shadows on the
	ground as a light moves by.
	</paragraph>
      </when>
      <how>
	<paragraph>
	  Start from a line (as the abstraction of a post) standing vertically
	  on the <math latex="XY">XY</math>-plane. Define a free point<latex>\index{point}</latex> as the
	  moving light. The <em>shadow point</em> is the projection of the free
	  point onto the <math latex="XY">XY</math>-plane. The shadow is a line<latex>\index{line}</latex>
	  between the base of the post and its shadow point. Replicating the
	  startpoint of the posts gives a row of posts, each with its own
	  shadow. In this case, the source is the free point, the projection is
	  a perspective projection through the source and the receiver is the
	  <math latex="xy">xy</math>-plane.
	</paragraph>
       <web>
	 <diagram>
	   <img src="ImgProjC.png" width="500"/>
	 </diagram>
       </web>
      </how>
      <a href="Samples/ProjPointPost/ProjPointPost.gct" >Download ProjPointPost.gct</a>
      <animation src="Samples/ProjPointPost/AnimationPointPost.swf"/>
    </sample>

    <sample id="Skylight">
      <name>Skylight</name>
	<diagram>
	  <img src="LeCorbSaintMarie_Pieter_Morlion.jpg" width="300" height="400" />
	</diagram>
	<latex>

	  \sourceLocated{Pieter Morlion}
	</latex>
      <when>
	<paragraph> Create a daylight "lens" that focuses on a circle.
	</paragraph>
      </when>
      <how>
	<paragraph>
	  Two free-form surfaces<latex>\index{surface}</latex> represent a roof structure and ceiling. The
	  <math latex="xy">xy</math>-plane represents a floor. A circle<latex>\index{circle}</latex> on the
	  floor can be daylit by projecting it through the ceiling and roof
	  surfaces. The direction of daylight is nearly uniform, but the two
	  separated holes will act as a very fuzzy lens to focus daylight on the
	  circle. Similar to the <em>Surface Sampler</em> sample, the projection
	  direction is controlled by a free point<latex>\index{point}</latex>. If the direction is chosen to
	  lie within the sun's annual range, the sun will shine directly on the
	  circle exactly twice a year. If the direction is chosen to lie on
	  either of the two solstice paths, this reduces to exactly once per
	  year. Fixed architecture can have difficulty in responding to moving
	  phenomena. 
	</paragraph>
	<paragraph>
	  The projection of a circle onto a surface, or even an angled
	  plane, is no longer a circle. While some parametric modelers
	  may provide curve onto surface projection tools, a good
	  approximation can be had by projecting sampled points on the
	  circle and reconstructing the curve<latex>\index{curve}</latex> from the projected
	  points. The resulting curve will not exactly coincide with
	  the surface in which it should lie. Alternatively, if the
	  modeller has surface trimmming tools, trimming the surface
	  with a sweep of the circle along the projection line will
	  yield a new surface with a hole.
	</paragraph>
	<paragraph>	  
	  When rotating the model, you can see that
	  three circles perfectly coincide at a specific viewing angle (in a
	  parallel viewing projection).
	</paragraph>
	<paragraph>
          A famous example of projection used in form-making is Le
          Corbusier's 1953  Monastery of Sainte-Marie
          de La Tourette in France (shown in the image above).
	</paragraph>
	<web>
	<diagram>
	  <img src="ImgProjA.jpg" width="300" height="400" /> 
	</diagram>
	</web>
      </how>
      <a href="Samples/ProjSkylight/ProjSkylight.gct" >Download
      ProjSkylight.gct</a>
      <animation src="Samples/ProjSkylight/AnimationSkylight.swf"/>
    </sample>

    <sample id="Spotlight">

      <name>Spotlight</name>
      <when>
	<paragraph> Model a metaphorical spotlight projecting a circle shape
	onto several surfaces.
	</paragraph>
      </when>
      <how>
	<paragraph>
	  This sample is very similar to the previous one. The main
	  difference is that all the projecting rays intersect at the
	  light point. To calculate the projection, each projecting
	  ray starts from the light point and goes through the
	  sampling points of the base circle. While rotating the
	  model in a parallel projection view, you can see the projected circles
	  do not coincide at any angle. If you use a perspective view the
	  projected circles<latex>\index{circle}</latex> coincide when the camera and light source coincide.
	</paragraph>
	<paragraph>
	  <latex>
	    \begin{bodyNote}
 	      \pbOneCol
	        {\input{\GCFigsPath/Patterns/ProjectionSpotlightExplain0.tex}}
	    \end{bodyNote}
	  </latex>
	</paragraph>
      </how>
      <a href="Samples/ProjSpotlight/ProjSpotlight.gct" >Download ProjSpotlight.gct</a>
      <animation src="Samples/ProjSpotlight/AnimationSpotlight.swf"/>
    </sample>

    <sample id="SolarPolygonShadow">
      <name>Solar Polygon Shadow</name>
      <when>
	<paragraph> The shadow of a polygon cast by the sun on a curved surface.
	</paragraph>
      </when>
      <how>
	<paragraph>
	  <latex>\index{point|(}</latex>
	  <latex>\index{line|(}</latex>
	  <latex>\index{polygon|(}</latex>
	  <latex>\index{curve|(}</latex>
	  <latex>\index{surface|(}</latex>
	  The source is a polygon, the receiver a free-form
	  surface. The projector is the sun, therefore the projecting
	  rays are parallel. 
	<paragraph>
	</paragraph>
	  Straight lines project as curves onto a surface. For specific surface
	  types, such as conic sections<latex>\index{conic section}</latex>, there are closed-form equations for
	  these curves. For free-form surfaces, approximations must suffice.
	  Even though a curve projection tool may be available in your chosen
	  parametric modeler, techniques for making such an approximation are an
	  important part of a modeler's toolkit. The key is sampling. Sample
	  each line of the source with a sequence of points. The choice of how
	  many points depends on the complexity of the receiving surface: high
	  curvature and rapidly changing surface normals will require more
	  samples. Project the sampled points onto the surface and reconstruct
	  a curve "on" the surface from the sampled points. The word "on" is
	  advisory---the curve will not lie exactly on the surface. Much
	  representation is approximation. If the curve must exactly coincide
	  with the surface, either sample very densely or find a modeler that
	  supports exact curve-to-surface projection. 
	<paragraph>
	</paragraph>
	  It is clear that the shadow is no longer bounded by four straight lines,
	  but by four curves. Note too a further simplifying assumption. Non-planar
	  polygons can thought of as defining a minimal surface. If the source
	  polygon is nonplanar then its orientation must be such that no part of
	  this minimal surface projects outside of the projection of the polygon's
	  edges. Else, the shadow will not model reality. This may be good
	  enough---again, much representation in design is approximate.
	</paragraph>
      </how>
      <a href="Samples/ProjParaShadow/ProjParaShadow.gct" >Download ProjParaShadow.gct</a>
      <animation src="Samples/ProjParaShadow/AnimationParaShadow.swf"/>
    </sample>
    
	<web>
    <sample id="SpotlightPolygonShadow">
      <name>Spotlight Polygon Shadow</name>
      <when>
	<paragraph> The shadow of a polygon cast by the spotlight on a curved surface.
	</paragraph>
      </when>
      <how>
	<paragraph>
	  This sample is very similar to the previous one. The main difference
	  is that all the projecting paths intersect at the spotlight point. To
	  calculate the projection, each projecting path starts from the
	  spotlight. When the spotlight moves closer to the polygon, the size
	  of shadow increases quickly.
	  <latex>\index{point|)}</latex>
	  <latex>\index{line|)}</latex>
	  <latex>\index{polygon|)}</latex>
	  <latex>\index{curve|)}</latex>
	  <latex>\index{surface|)}</latex>
	</paragraph>
      </how>	
      <a href="Samples/ProjPointShadow/ProjPointShadow.gct" >Download ProjPointShadow.gct</a>
      <animation src="Samples/ProjPointShadow/AnimationPointShadow.swf"/>
    </sample>
    </web>
	
    <sample id="">
      <name>Pinhole Camera</name>
      <when>
	<paragraph> Model a pinhole camera.
	</paragraph>
      </when>
      <how>
	<paragraph>
	  A pinhole camera is a camera without a conventional glass
	  lens. An extremely small hole in very thin material can
	  focus light by confining all rays from a scene through a
	  single point. In order to produce a reasonably clear image,
	  the aperture diameter has to be less than about 1/100 of the
	  distance between the pinhole and the screen.
	</paragraph>
	<paragraph>
	<diagram>
	  <img src="ImgProjD.pdf" width="400"/>
	</diagram>
	</paragraph>
	<paragraph>
	  The principle of a pinhole camera is that light rays from an object
	  pass through a small hole to form an image on the screen (shown in
	  image above). To model this effect, simply place a point<latex>\index{point}</latex> (modeling the
	  pinhole) between the source and receiver and project from the source
	  through the pinhole to the receiver. Use the sampling technique from
	  the <em>Solar Polygon Shadow</em> sample above to reconstruct the
	  source on the receiver.
	</paragraph>
	<paragraph>
	  Note that the image is reflected both top-to-bottom and
	  left-to-right. This is equivalent to a <math latex="180^\circ">180
	  degree</math> rotation about the axis normal to the receiving plane
	  and through the pinhole (providing the receiver is a plane).<latex>\index{transformation!projection|)}</latex>
	</paragraph>
      </how>
      <a href="Samples/ProjPointCamera/ProjPointCamera.gct" >Download ProjCamera.gct</a>
      <animation src="Samples/ProjPointCamera/AnimationPointCamera.swf"/>
    </sample>
    <web>
    <sample id="">
      <name>Kaleidoscope</name>
      <when>
	<paragraph>
	  Model a kaleidoscope.
	</paragraph>
      </when>
      <how>
	<diagram>
	  <img src="ImgProjE1.jpg" width="300"/> <img src="ImgProjE2.jpg" width="300"/>
	</diagram>
	<paragraph>
	  The kaleidoscope is a tubelike instrument containing loose bits and
	  pieces that are reflected by mirrors so that various symmetrical
	  patterns appear as the instrument is rotated. Many people have played
	  with this toy. This sample does not seriously follow the principles of
	  mirroring in the tube. Instead, it uses
	  <patternName>Projection</patternName> and replication to simulate the
	  effect of a kaleidoscope.
	</paragraph>
	<paragraph>
	  The source curve lies on a plane (modeling the loose bits and
	  pieces). You create a free point and vector to model the central axis
	  of the tube. Build three symmetric surfaces surrounding
	  the axis to model the internal mirrors. The first step projects the
	  curve from the target coordinate system to the surrounding
	  mirrors. Then the second <patternName>Projection</patternName> is from
	  the mirrors to the bottom plan. As you can see, the result of these
	  two steps is totally different from a direct
	  <patternName>Projection</patternName>. Since the three mirrors in a
	  real kaleidoscope
	  reflect images among each other, you can replicate the resulting image
	  and get a kaleidoscope effect. When you move either the target
	  coordinate system or the central axis, the bottom image shifts and
	  varies.
	</paragraph>
      </how>
      <a href="Samples/ProjParaKaleidoscope/ProjParaKaleidoscope.gct" >Download ProjParaKaleidoscope.gct</a>
      <animation src="Samples/ProjParaKaleidoscope/AnimationParaKaleidoscope.swf"/>
    </sample>
    </web>
  </samples>
</pattern>

