VTK中建立圓柱體

2021-07-02 00:16:56 字數 886 閱讀 7693

1 使用vtkcylindersource來建立。vtkcylindersource可以建立沿著世界座標系y軸方向的圓柱體,但是不能任意設定圓柱體長軸的方向。

vtksmartpointercylinder = vtksmartpointer::new();

cylinder->setheight(20.0);

cylinder->setcenter(origin[0] - 5.0 * normal[0], origin[1] - 5.0 * normal[1], origin[2] - 5.0 * normal[2]);

cylinder->setradius(3.0);

cylinder->setresolution(100);

2 如果已經知道了圓柱長軸的兩個端點,可以結合vtklinesource和vtktubefilter來生成具有方向性的圓柱體

vtksmartpointerline = vtksmartpointer::new();

line->setpoint1(origin[0], origin[1], origin[2]);

line->setpoint2(origin[0] - 5.0 * normal[0], origin[1] - 5.0 * normal[1], origin[2] - 5.0 * normal[2]);

vtksmartpointertubefilter = vtksmartpointer::new();

tubefilter->setinputconnection(line->getoutputport());

tubefilter->setradius(3.0);

tubefilter->setnumberofsides(100);

圓柱體計算

problem description 已知圓柱體的底面半徑r和高h,計算圓柱體底面周長和面積 圓柱體側面積以及圓柱體體積。其中圓周率定義為3.1415926。input 輸入資料有一行,包括2個正實數r和h,以空格分隔。output 輸出資料一行,包括圓柱體底面周長和面積 圓柱體側面積以及圓柱體體...

圓柱體計算

圓柱體計算 description 已知圓柱體的底面半徑r和高h,計算圓柱體底面周長和面積 圓柱體側面積以及圓柱體體積。其中圓周率定義為3.1415926。input 輸入資料有一行,包括2個正實數r和h,以空格分隔。output 輸出資料一行,包括圓柱體底面周長和面積 圓柱體側面積以及圓柱體體積,...

Java圓柱體積

定義乙個圓類 circle 其所在的包為bzu.info.software 定義乙個圓柱類cylinder,其所在的包為bzu.info.com 定義乙個主類a,其所在的包也為bzu.info.com,在a中生成乙個cylinder物件,並輸出其體積。編譯並執行該類。試著改變求體積方法的訪問許可權,...