001/*
002
003*/
004package renderer.models;
005
006/**
007   Create a wireframe model of a right circular cone with its base
008   parallel to the xz-plane and its apex on the positive y-axis.
009<p>
010   See <a href="https://en.wikipedia.org/wiki/Cone" target="_top">
011                https://en.wikipedia.org/wiki/Cone</a>
012<p>
013   This model can also be used to create right k-sided polygonal pyramids.
014<p>
015   See <a href="https://en.wikipedia.org/wiki/Pyramid_(geometry)" target="_top">
016                https://en.wikipedia.org/wiki/Pyramid_(geometry)</a>
017
018   @see ConeFrustum
019*/
020public class Cone extends ConeSector
021{
022   /**
023      Create a right circular cone with its base in the xz-plane,
024      a base radius of 1, height 1, and apex on the positve y-axis.
025   */
026   public Cone( )
027   {
028      this(1, 1, 15, 16);
029   }
030
031
032   /**
033      Create a right circular cone with its base in the xz-plane,
034      a base radius of {@code  r}, height {@code  h}, and apex on
035      the y-axis.
036
037      @param r  radius of the base in the xz-plane
038      @param h  height of the apex on the y-axis
039   */
040   public Cone(double r, double h)
041   {
042      this(r, h, 15, 16);
043   }
044
045
046   /**
047      Create a right circular cone with its base in the xz-plane,
048      a base radius of {@code  r}, height {@code  h}, and apex on
049      the y-axis.
050   <p>
051      The last two parameters determine the number of lines of longitude
052      and the number of circles of latitude in the model.
053   <p>
054      Notice that if there are {@code  n} circles of latitude in the model
055      (including the bottom edge), then each line of longitude will have
056      {@code  n+1} line segments. If there are {@code  k} lines of longitude,
057      then each circle of latitude will have {@code  k} line segments.
058   <p>
059      There must be at least three lines of longitude and at least
060      one circle of latitude.
061   <p>
062      By setting {@code  k} to be a small integer, this model can also
063      be used to create k-sided polygonal pyramids.
064
065      @param r  radius of the base in the xz-plane
066      @param h  height of the apex on the y-axis
067      @param n  number of circles of latitude around the cone
068      @param k  number lines of longitude
069   */
070   public Cone(double r, double h, int n, int k)
071   {
072      this(r, 0, h, n, k);
073   }
074
075
076   /**
077      Create a right circular cone with its base parallel to the xz-plane at
078      height {@code  y = h1}, a base radius of {@code  r}, and apex on the
079      y-axis at {@code  y = h2}.
080   <p>
081      The last two parameters determine the number of lines of longitude and
082      the number of circles of latitude in the model.
083   <p>
084      Notice that if there are {@code  n} circles of latitude in the model
085      (including the bottom edge), then each line of longitude will have
086      {@code  n+1} line segments. If there are {@code  k} lines of longitude,
087      then each circle of latitude will have {@code  k} line segments.
088   <p>
089      There must be at least three lines of longitude and at least
090      one circle of latitude.
091   <p>
092      By setting {@code  k} to be a small integer, this model can also
093      be used to create k-sided polygonal pyramids.
094
095      @param r   radius of the base in the xz-plane
096      @param h1  height of the base on the y-axis
097      @param h2  height of the apex on the y-axis
098      @param n   number of circles of latitude around the cone
099      @param k   number lines of longitude
100   */
101   public Cone(double r, double h1, double h2, int n, int k)
102   {
103      super(r, h1, h2, h2, 0, 2*Math.PI, n, k);
104   }
105}//Cone