资源简介
计算机图形学基础教程案例源码,B样条曲面代码,很实用
代码片段和文件信息
// Copyright (C) 1991 - 1999 Rational Software Corporation
#include “stdafx.h“
#include “BH_BSpline.h“
#include
BH_BSpline::BH_BSpline(int Row int Column int uOrder int vOrder int utype int vtype int Precision double* dpCtlPts)
{
iRow=Row;
iColumn=Column;
memset(dpControlPoints 0 MAXCONTROLPOINTS*sizeof(double));
if ( dpCtlPts != NULL )
set_dpControlPoints(dpCtlPts);
else
{
srand( (unsigned)time( NULL ) );
int u v;
for (v = 0; v <= iColumn; v++)
{
for (u = 0; u <= iRow; u++)
{
if ( iRow == 0 )
dpControlPoints[(v*(iRow+1)+u)*3+0] = -0.5;
else
dpControlPoints[(v*(iRow+1)+u)*3+0] = (GLdouble)u/iRow-0.5;
if ( iColumn == 0 )
dpControlPoints[(v*(iRow+1)+u)*3+1] = -0.5 ;
else
dpControlPoints[(v*(iRow+1)+u)*3+1] = (GLdouble)v/iColumn-0.5;
dpControlPoints[(v*(iRow+1)+u)*3+2] = (GLdouble)4/(iRow+iColumn)*(rand()%2);
}
}
}
memset(dpKnotsU 0 MAXKNOTS*sizeof(double));
memset(dpKnotsV 0 MAXKNOTS*sizeof(double));
UType=utype;
VType=vtype;
iUOrder=uOrder;
iVOrder=vOrder;
update_dpKnots(U);
update_dpKnots(V);
iPrecision=Precision;
bDrawControlPoints=false;
bDrawDiffVector=false;
bWireframe=true;
bTexture=false;
bLight=false;
for ( int v = 0; v for ( int u = 0; u bControlPointsSelected[v][u] = false ;
}
BH_BSpline::~BH_BSpline()
{
}
void BH_BSpline::set_dpControlPoints(double* value)
{
memcpy(dpControlPoints value (iRow+1)*(iColumn+1)*3*sizeof(double));
return;
}
void BH_BSpline::set_dpKnotsU(double* value)
{
memcpy(dpKnotsU value (iRow+iUOrder+1)*sizeof(double));
return;
}
void BH_BSpline::set_dpKnotsV(double* value)
{
memcpy(dpKnotsV value (iColumn+iVOrder+1)*sizeof(double));
return;
}
double* BH_BSpline::get_dpKnotsU()
{
return dpKnotsU ;
}
double* BH_BSpline::get_dpKnotsV()
{
return dpKnotsV ;
}
const int BH_BSpline::get_iPrecision() const
{
return iPrecision;
}
void BH_BSpline::set_iPrecision(int value)
{
iPrecision = value;
return;
}
const int BH_BSpline::get_iRow() const
{
return iRow;
}
const int BH_BSpline::get_iColumn() const
{
return iColumn;
}
void BH_BSpline::set_iUOrder(int value)
{
if ( value < 0 || value > iRow )
{
AfxMessageBox(“阶次k必须大于等于0且小于等于n“);
return;
}
iUOrder = value ;
update_dpKnots(U) ;
return;
}
void BH_BSpline::set_iVOrder(int value)
{
if ( value < 0 || value > iColumn )
{
AfxMessageBox(“阶次k必须大于等于0且小于等于n“);
return;
}
iVOrder = value ;
update_dpKnots(V) ;
return;
}
void BH_BSpline::set_UType(int type)
{
UType=type;
update_dpKnots(U);
}
void BH_BSpline::set_VType(int type)
{
VType=type;
update_dpKnots(V);
}
const int BH_BSpline::get_UType() const
{
return UType;
}
const int BH_BSpline::get_VType() const
{
return VType;
}
const int BH_BSpline::get_
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 24790 2008-02-21 00:05 BSpline1\BH_BSpline.cpp
文件 6513 2008-02-20 23:58 BSpline1\BH_BSpline.h
文件 31828 2008-06-01 21:55 BSpline1\BSpline.aps
文件 4143 2008-06-01 22:04 BSpline1\BSpline.clw
文件 4495 2008-02-04 10:36 BSpline1\BSpline.cpp
文件 5007 2008-02-18 22:46 BSpline1\BSpline.dsp
文件 522 2008-01-22 11:42 BSpline1\BSpline.dsw
文件 1483 2008-01-22 11:42 BSpline1\BSpline.h
文件 214016 2008-06-05 20:02 BSpline1\BSpline.ncb
文件 54784 2008-06-05 20:02 BSpline1\BSpline.opt
文件 248 2008-06-03 20:22 BSpline1\BSpline.plg
文件 15298 2008-02-19 20:21 BSpline1\BSpline.rc
文件 3328 2008-02-17 18:59 BSpline1\BSplineDoc.cpp
文件 1827 2008-02-17 18:59 BSpline1\BSplineDoc.h
文件 2270 2008-02-18 22:07 BSpline1\BSplineSettingDlg.cpp
文件 1425 2008-02-04 11:23 BSpline1\BSplineSettingDlg.h
文件 16323 2008-02-19 20:38 BSpline1\BSplineView.cpp
文件 3310 2008-02-19 17:51 BSpline1\BSplineView.h
文件 1135533 2008-01-22 16:29 BSpline1\BSPLINE_UML.mdl
文件 1135533 2008-01-22 16:29 BSpline1\BSPLINE_UML.md~
文件 2893 2008-02-16 16:49 BSpline1\Debug\8-8.txt
文件 734 2008-02-01 18:59 BSpline1\Debug\bh_bspline.txt
文件 705 2008-02-02 13:06 BSpline1\Debug\bh_bspline_order0.txt
文件 723 2008-02-02 13:06 BSpline1\Debug\bh_bspline_order1.txt
文件 741 2008-02-02 13:06 BSpline1\Debug\bh_bspline_order2.txt
文件 759 2008-02-02 13:06 BSpline1\Debug\bh_bspline_order3.txt
文件 710 2008-02-05 12:10 BSpline1\Debug\bh_bspline_u.txt
文件 3302400 2008-06-01 21:56 BSpline1\Debug\BSpline.bsc
文件 116789 2008-02-19 19:11 BSpline1\Debug\Help.chm
文件 759 2008-02-03 11:31 BSpline1\Debug\均匀U0-Un+k+1 0-1.txt
............此处省略34个文件信息
评论
共有 条评论