亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lathecurve.java

?? JAVA的一個程序
?? JAVA
字號:
package Mover3D;


// LatheCurve.java
// Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th

/* A Lathe Curve is a series of (x,y) points representing a
   curve made up of curve segments and straight lines. 

   The lathe curve starts at y==0, and moves upwards. All the coords
   must be positive, since the intention is to rotate the lathe curve
   around the y-axis to make a shape.

   The curve segments in a Lathe curve are interpolated from (x,y) pts
   using Hermite interpolation. This requires tangents to be supplied
   for the points, which are calculated using a variant of the
   Catmull-Rom algorithm for splines. 

   For a given pair of coordinates (e.g. (x1,y1), (x2,y2)) a curve segment
   is created by adding an additional STEP points between them.

   Thus, the supplied sequence of (x,y) points is extended to make
   a sequence representing the Lathe curve. This extended sequence
   is accessible by calling getXs() and getYs().

   A given point (x,y) may start a curve segment or a straight line going 
   to the next point. We distinguish by making the x-value negative
   to mean that it should start a straight line. The negative sign
   is removed when the resulting sequence is created.
   *  This is a bit of a hack, but makes a Lathe curve easy to specify
      without requiring complex d.s for the input sequence.
*/

import javax.vecmath.*;


public class LatheCurve
{
  // number of interpolation points added between two input points
  private final static int STEP = 5;

  double xs[], ys[];     // sequences of (x,y)'s representing the curve
  double height;         // max height of curve (the largest y-value)


  public LatheCurve(double xsIn[], double ysIn[])
  {
    checkLength(xsIn, ysIn);
    checkYs(ysIn);
    int numVerts = xsIn.length;

    // set startTangent to be heading to the right
    Point2d startTangent =      // tangent for first pt in input sequence
        new Point2d((Math.abs(xsIn[1]) - Math.abs(xsIn[0]))*2, 0);

    // set endTangent to be heading to the left
    Point2d endTangent =        // tangent for last pt in input sequence
         new Point2d((Math.abs(xsIn[numVerts-1]) - 
                      Math.abs(xsIn[numVerts-2]))*2, 0); 

    /* Multiplying the tangents by 2 makes them stronger, which makes the 
       curve move more in the specified direction. */

    makeCurve(xsIn, ysIn, startTangent, endTangent);
  }  // end of LatheCurve()


  public LatheCurve(double xsIn[], double ysIn[], 
					Point2d startTangent, Point2d endTangent)
  // let the user supply the starting and ending tangents
  {
    checkLength(xsIn, ysIn);
    checkYs(ysIn);
    checkTangent(startTangent);
    checkTangent(endTangent);
    makeCurve(xsIn, ysIn, startTangent, endTangent);
  } // end of LatheCurve()



  private void checkLength(double xsIn[], double ysIn[])
  // tests related to the sequences's length
  {
    int numVerts = xsIn.length;

    if (numVerts < 2) {
      System.out.println("Not enough points to make a curve");
      System.exit(0);
    }
    else if (numVerts != ysIn.length) {
      System.out.println("xsIn[] and ysIn[] do not have the same number of points");
      System.exit(0);
    }
  } // end of checkLength()


  private void checkYs(double[] ysIn)
  /* Tests of the y-components of the sequence. 
     Also find the largest y-value, which becomes the curve's height.
  */
  {
    if (ysIn[0] != 0) {
      System.out.println("The first y-coordinate must be 0; correcting it");
      ysIn[0] = 0;
    }

   // find max height and make all y-coords >= 0
    height = ysIn[0]; 
    for(int i=1; i < ysIn.length; i++) {
      if (ysIn[i] >= height)
        height = ysIn[i];
      if (ysIn[i] < 0) {
        System.out.println("Found a negative y-coord; changing it to be 0");
        ysIn[i] = 0;
      }
    }
    if (height != ysIn[ ysIn.length-1 ])
      System.out.println("Warning: max height is not the last y-coordinate");
    
  }  // end of checkYs()


  private void checkTangent(Point2d tangent)
  {
    if ((tangent.x == 0) && (tangent.y == 0)) {
      System.out.println("A tangent cannot be (0,0)");
      System.exit(0);
    }
  }  // end of checkTangent()


  private void makeCurve(double xsIn[], double ysIn[], 
					Point2d startTangent, Point2d endTangent)
  {
    int numInVerts = xsIn.length;
    int numOutVerts = countVerts(xsIn, numInVerts);
    xs = new double[numOutVerts];    // resulting sequence after adding extra pts
    ys = new double[numOutVerts];

    xs[0] = Math.abs(xsIn[0]);    // start of curve is initialised
    ys[0] = ysIn[0];
    int startPosn = 1;

    // holds the tangents for the current curve segment between two points
    Point2d t0 = new Point2d();
    Point2d t1 = new Point2d();

    for (int i=0; i < numInVerts-1; i++) {
      if (i == 0)
        t0.set( startTangent.x, startTangent.y);
      else   // use previous t1 tangent
        t0.set(t1.x, t1.y);

      if (i == numInVerts-2)    // next point is the last one
        t1.set( endTangent.x, endTangent.y);
      else
        setTangent(t1, xsIn, ysIn, i+1);   // tangent at pt i+1

      // if xsIn[i] < 0 then use a straight line to link (x,y) to next (x,y)
      if (xsIn[i] < 0) {
        xs[startPosn] = Math.abs(xsIn[i+1]);    // in case the next pt is -ve also
        ys[startPosn] = ysIn[i+1];
        startPosn++;
      }
      else {   // make a Hermite curve between the two points by adding STEP new pts
        makeHermite(xs, ys, startPosn, xsIn[i], ysIn[i], xsIn[i+1], ysIn[i+1], t0, t1);
        startPosn += (STEP+1);
      }
    }
  }  // end of makeCurve()


  private int countVerts(double xsIn[], int num)
  /* The number of points in the new sequence depends on how many
     curve segments are to be added. Each curve segment between two points adds 
     STEP points to the sequence.

     A (x,y) point where x is negative starts a straight line, so no
     new points are added. If s is positive, then STEP points will
     be added.
  */
  {
    int numOutVerts = 1;   // counting last coord
    for(int i=0; i < num-1; i++) {
      if (xsIn[i] < 0)   // straight line starts here
        numOutVerts++;
      else    // curve segment starts here 
        numOutVerts += (STEP+1);
    }
    return numOutVerts;
  }  // end of countVerts()



  private void setTangent(Point2d tangent, double xsIn[], double ysIn[], int i)
  /* Calculate the tangent at position i
     using Catmull-Rom spline-based interpolation
  */
  {
    double xLen = Math.abs(xsIn[i+1]) - Math.abs(xsIn[i-1]);   // ignore any -ve
    double yLen = ysIn[i+1] - ysIn[i-1];
    tangent.set(xLen/2, yLen/2);
  }  // end of setTangent()




  private void makeHermite(double[] xs, double[] ys, int startPosn,
			double x0, double y0, double x1, double y1, Point2d t0, Point2d t1)
  /* Calculate the Hermite curve's (x,y) coordinates between points
     (x0,y0) and (x1,y1). t0 and t1 are the tangents for those points.

     The (x0,y0) point is not included, since it was added at the
     end of the previous call to makeHermite().

     Store the coordinates in the xs[] an ys[] arrays, starting
     at index startPosn.
  */
  { 
    double xCoord, yCoord;   
    double tStep = 1.0/(STEP+1);
    double t;

    if (x1 < 0)      // next point is negative to draw a line, make it
      x1 = -x1;      // +ve while making the curve

    for(int i=0; i < STEP; i++) {
      t = tStep * (i+1);
      xCoord = (fh1(t) * x0) + (fh2(t) * x1) +
               (fh3(t) * t0.x) + (fh4(t) * t1.x);
      xs[startPosn+i] = xCoord;

      yCoord = (fh1(t) * y0) + (fh2(t) * y1) +
               (fh3(t) * t0.y) + (fh4(t) * t1.y);
      ys[startPosn+i] = yCoord;
    }

    xs[startPosn+STEP] = x1;
    ys[startPosn+STEP] = y1;
  }  // end of makeHermite()


  /* Hermite blending functions. 
     The first two functions blend the two points, the last two
     blend the two tangents.
     For an explanation of how the functions are derived, see any 
     good computer graphics text, e.g. Foley and Van Dam. */

  private double fh1(double t)
  {  return (2.0)*Math.pow(t,3) - (3.0*t*t) + 1;  }

  private double fh2(double t)
  {  return (-2.0)*Math.pow(t,3) + (3.0*t*t); }

  private double fh3(double t)
  {  return Math.pow(t,3) - (2.0*t*t) + t; }

  private double fh4(double t)
  {  return Math.pow(t,3) - (t*t);  }


  // ----------------------------------------
  // access generated coords and height

  public double[] getXs()
  {  return xs;  }

  public double[] getYs()
  {  return ys;  }

  public double getHeight()
  {  return height;  }

}  // end of LatheCurve class

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区四区在线观看 | av在线综合网| 亚洲激情图片qvod| 久久久精品日韩欧美| 欧美日韩一区二区三区四区| 成人午夜免费电影| 国产精品一级片| 丝袜诱惑亚洲看片| 洋洋成人永久网站入口| 久久久久久久综合日本| 精品久久久网站| 3d动漫精品啪啪一区二区竹菊| 99在线热播精品免费| 国产精品18久久久久久久网站| 麻豆国产一区二区| 日韩高清在线一区| 亚洲成人免费看| 天天色综合天天| 亚洲成人激情社区| 日韩国产在线一| 青娱乐精品在线视频| 亚洲精品国产视频| 亚洲精品国产a| 伊人性伊人情综合网| 亚洲伊人伊色伊影伊综合网| 亚洲免费观看高清在线观看| 亚洲视频小说图片| 一区二区三区在线观看动漫| 一区二区三区在线看| 亚洲电影中文字幕在线观看| 亚洲va国产天堂va久久en| 性久久久久久久久| 免费观看30秒视频久久| 精品一区二区在线播放| 国产精品一级在线| 91丨九色丨黑人外教| 91亚洲精品乱码久久久久久蜜桃 | 欧美在线免费观看亚洲| 日本大香伊一区二区三区| 国产精品一区专区| 99国内精品久久| 欧美日韩在线电影| 91麻豆精品国产自产在线观看一区 | 久久久久高清精品| 国产精品电影一区二区三区| 亚洲福中文字幕伊人影院| 激情综合五月天| 国产成人亚洲综合a∨婷婷| 国内外成人在线视频| 国产盗摄精品一区二区三区在线| 99久久久精品| 欧美一级片在线看| 国产精品卡一卡二卡三| 一区二区在线电影| 激情综合五月天| 在线观看视频一区| 精品国产免费人成电影在线观看四季| 亚洲精品一区二区三区福利| 成人欧美一区二区三区小说| 日本在线播放一区二区三区| 成人激情校园春色| 日韩亚洲欧美一区二区三区| 国产精品亲子伦对白| 丝袜美腿一区二区三区| 波多野洁衣一区| 日韩一区二区在线观看| 中文字幕一区二区三区在线播放| 日本va欧美va精品| caoporen国产精品视频| 欧美大白屁股肥臀xxxxxx| 成人免费一区二区三区在线观看| 日本中文字幕一区二区有限公司| 成a人片亚洲日本久久| 欧美一级专区免费大片| 玉米视频成人免费看| 成人美女视频在线观看18| 日韩你懂的在线观看| 偷窥少妇高潮呻吟av久久免费| 成人免费毛片嘿嘿连载视频| 日韩欧美一区二区在线视频| 亚洲一区在线观看网站| 成人国产亚洲欧美成人综合网 | 日韩精品视频网站| 色呦呦日韩精品| 国产精品伦理在线| 国产成人精品一区二区三区网站观看| 欧美日韩欧美一区二区| 亚洲视频精选在线| av亚洲精华国产精华精| 欧美激情综合五月色丁香| 国产一区二区美女| 精品国产一区二区三区久久久蜜月 | 蜜桃精品视频在线观看| 99精品欧美一区| **欧美大码日韩| 不卡影院免费观看| 国产区在线观看成人精品| 国产精品一区二区久久精品爱涩| 欧美色窝79yyyycom| 亚洲欧美日韩在线| 成人中文字幕在线| 久久综合九色综合欧美亚洲| 国产一区二区调教| 精品国产91乱码一区二区三区| 蜜臀av性久久久久蜜臀aⅴ| 欧美日韩免费视频| 三级精品在线观看| 日韩一区二区三区免费看| 另类综合日韩欧美亚洲| 久久亚洲综合色| 国产精品资源在线| 国产精品国产三级国产普通话99| 丁香另类激情小说| 自拍偷拍国产精品| 成人h版在线观看| 国产婷婷精品av在线| 成人免费毛片a| **网站欧美大片在线观看| 欧美在线一二三| 另类专区欧美蜜桃臀第一页| 国产亚洲制服色| 91毛片在线观看| 亚洲成人1区2区| 久久这里只精品最新地址| 国产精品一级片在线观看| 综合久久一区二区三区| 欧美人成免费网站| 国产一区二区三区在线观看免费视频 | 亚洲大片精品永久免费| 日韩精品一区国产麻豆| 盗摄精品av一区二区三区| 亚洲一区二区成人在线观看| 欧美一区二区三区性视频| 国内一区二区视频| 一区二区三区电影在线播| 欧美一级日韩一级| 97久久超碰精品国产| 免费看欧美女人艹b| 亚洲欧洲一区二区在线播放| 日韩一区二区三区电影| hitomi一区二区三区精品| 亚洲高清免费一级二级三级| 国产欧美日韩在线| 欧美一区二区网站| 91香蕉视频污| 激情五月激情综合网| 亚洲国产精品综合小说图片区| 久久毛片高清国产| 欧美高清dvd| 色综合咪咪久久| 丰满亚洲少妇av| 裸体歌舞表演一区二区| 亚洲自拍欧美精品| 亚洲欧美一区二区视频| 亚洲精品在线一区二区| 欧美日韩一区二区不卡| av亚洲精华国产精华精| 国产精品一区二区在线观看不卡| 日韩精品视频网| 亚洲午夜激情av| 亚洲欧美一区二区三区久本道91| 久久久久九九视频| 久久久午夜电影| 欧美tk丨vk视频| 精品欧美黑人一区二区三区| 91麻豆精品国产无毒不卡在线观看| 一本久道中文字幕精品亚洲嫩| 成人91在线观看| 99国产精品久久久久久久久久| 风间由美一区二区三区在线观看 | 成人av在线播放网址| 国产精品一二三区| 激情偷乱视频一区二区三区| 美女爽到高潮91| 日欧美一区二区| 亚洲国产一区二区三区| 中文字幕 久热精品 视频在线 | 成人av集中营| 99久久国产综合精品色伊| 99精品视频中文字幕| 成人一区二区三区视频在线观看| 精品一区二区国语对白| 狠狠色丁香久久婷婷综| 国产一区啦啦啦在线观看| 国产精品91xxx| 国产jizzjizz一区二区| 成人sese在线| 在线中文字幕不卡| 欧美日韩免费一区二区三区视频| 91麻豆精品国产91久久久久久 | 蜜臀av一区二区| 国产mv日韩mv欧美| 一本色道a无线码一区v| 欧美三级一区二区| 日韩欧美国产一区二区在线播放 | 在线看日韩精品电影| 久久日韩精品一区二区五区| 亚洲一区免费视频| 国产伦理精品不卡| 欧美精品xxxxbbbb|