Copyright (c) 2000 David F. Rogers. All rights reserved.
b[] = array containing the defining polygon vertices
b[1] contains the x-component of the vertex
b[2] contains the y-component of the vertex
b[3] contains the z-component of the vertex
Basis = function to calculate the Bernstein basis value (see MECG Eq 5-65)
cpts = number of points to be calculated on the curve
Fractrl = function to calculate the factorial of a number
j[] = array containing the basis functions for a single value of t
npts = number of defining polygon vertices
p[] = array containing the curve points
p[1] contains the x-component of the point
p[2] contains the y-component of the point
p[3] contains the z-component of the point
t = parameter value 0 <= t <= 1
*/
#include <math.h>
/* function to calculate the factorial */
float factrl(int n)
{
static int ntop=6
static float a[33]={1.0,1.0,2.0,6.0,24.0,120.0,720.0} /* fill in the first few values */
int j1
if (n < 0) printf("\nNegative factorial in routine FACTRL\n")
if (n > 32) printf("\nFactorial value too large in routine FACTRL\n")
while (ntop < n) { /* use the precalulated value for n = 0....6 */
j1 = ntop++
a[n]=a[j1]*ntop
}
return a[n] /* returns the value n! as a floating point number */
}
/* function to calculate the factorial function for Bernstein basis */
float Ni(int n,int i)
{
float ni
ni = factrl(n)/(factrl(i)*factrl(n-i))
return ni
}
/* function to calculate the Bernstein basis */
float Basis(int n,int i,float t)
{
float basis
float ti /* this is t^i */
float tni /* this is (1 - t)^i */
/* handle the special cases to avoid domain problem with pow */
if (t==0. && i == 0) ti=1.0 else ti = pow(t,i)
if (n==i && t==1.) tni=1.0 else tni = pow((1-t),(n-i))
basis = Ni(n,i)*ti*tni /* calculate Bernstein basis function */
return basis
}
/* Bezier curve subroutine */
bezier(npts,b,cpts,p)
int cpts
int npts
float b[]
float p[]
{
int i
int j
int i1
int icount
int jcount
int n
float step
float t
float factrl(int)
float Ni(int,int)
float Basis(int,int,float)
/* calculate the points on the Bezier curve */
icount = 0
t = 0
step = 1.0/((float)(cpts -1))
for (i1 = 1 i1<=cpts i1++){ /* main loop */
if ((1.0 - t) < 5e-6) t = 1.0
for (j = 1 j <= 3 j++){ /* generate a point on the curve */
jcount = j
p[icount+j] = 0.
for (i = 1 i <= npts i++){ /* Do x,y,z components */
p[icount + j] = p[icount + j] + Basis(npts-1,i-1,t)*b[jcount]
jcount = jcount + 3
}
}
icount = icount + 3
t = t + step
}
}
SAP basis可以理解为SAP的一个模块,也可以理解为SAP新的基于NW的一个component,不过不管你怎么理解,SAP basis会持久存在。SAP basis的职责总结为一句话“保障系统的建立和运行”,一句简单的话,意义可不简单。安装系统,参数调整,根据业务发展的系统扩展,网络和安全,硬件和容量,权限,传输,升级,监控,系统调优。SAP的产品众多,只怕你没有几年功夫,都只能算是个入门级别。
ABAP的原意是SAP专有的一种开发语言(advanced business application programming),现在简称SAP 基于ABAP端的developer为ABAP。工作职责就是基于业务的要求,在系统原有的基础上开发出新的业务功能。
这是一个简单的链表,main函数中定义了4个节点p0,p1,p2,p3; 因为每一个节点中存有一个值m_nKey和下一个节点的地址(也就是指针m_pNext); main函数中因为最后一个节点p3->m_pNext = NULL, 所以在length函数中求长度的时候可以通过判断是否是NU欢迎分享,转载请注明来源:内存溢出
评论列表(0条)