ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

m_eval.h
Go to the documentation of this file.
00001 
00002 /*
00003  * Mesa 3-D graphics library
00004  * Version:  3.5
00005  *
00006  * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
00007  *
00008  * Permission is hereby granted, free of charge, to any person obtaining a
00009  * copy of this software and associated documentation files (the "Software"),
00010  * to deal in the Software without restriction, including without limitation
00011  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00012  * and/or sell copies of the Software, and to permit persons to whom the
00013  * Software is furnished to do so, subject to the following conditions:
00014  *
00015  * The above copyright notice and this permission notice shall be included
00016  * in all copies or substantial portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00021  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00022  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00023  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00024  */
00025 
00026 #ifndef _M_EVAL_H
00027 #define _M_EVAL_H
00028 
00029 #include "main/glheader.h"
00030 
00031 void _math_init_eval( void );
00032 
00033 
00034 /*
00035  * Horner scheme for Bezier curves
00036  *
00037  * Bezier curves can be computed via a Horner scheme.
00038  * Horner is numerically less stable than the de Casteljau
00039  * algorithm, but it is faster. For curves of degree n
00040  * the complexity of Horner is O(n) and de Casteljau is O(n^2).
00041  * Since stability is not important for displaying curve
00042  * points I decided to use the Horner scheme.
00043  *
00044  * A cubic Bezier curve with control points b0, b1, b2, b3 can be
00045  * written as
00046  *
00047  *        (([3]        [3]     )     [3]       )     [3]
00048  * c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3
00049  *
00050  *                                           [n]
00051  * where s=1-t and the binomial coefficients [i]. These can
00052  * be computed iteratively using the identity:
00053  *
00054  * [n]               [n  ]             [n]
00055  * [i] = (n-i+1)/i * [i-1]     and     [0] = 1
00056  */
00057 
00058 
00059 void
00060 _math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t,
00061               GLuint dim, GLuint order);
00062 
00063 
00064 /*
00065  * Tensor product Bezier surfaces
00066  *
00067  * Again the Horner scheme is used to compute a point on a
00068  * TP Bezier surface. First a control polygon for a curve
00069  * on the surface in one parameter direction is computed,
00070  * then the point on the curve for the other parameter
00071  * direction is evaluated.
00072  *
00073  * To store the curve control polygon additional storage
00074  * for max(uorder,vorder) points is needed in the
00075  * control net cn.
00076  */
00077 
00078 void
00079 _math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v,
00080              GLuint dim, GLuint uorder, GLuint vorder);
00081 
00082 
00083 /*
00084  * The direct de Casteljau algorithm is used when a point on the
00085  * surface and the tangent directions spanning the tangent plane
00086  * should be computed (this is needed to compute normals to the
00087  * surface). In this case the de Casteljau algorithm approach is
00088  * nicer because a point and the partial derivatives can be computed
00089  * at the same time. To get the correct tangent length du and dv
00090  * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1.
00091  * Since only the directions are needed, this scaling step is omitted.
00092  *
00093  * De Casteljau needs additional storage for uorder*vorder
00094  * values in the control net cn.
00095  */
00096 
00097 void
00098 _math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv,
00099             GLfloat u, GLfloat v, GLuint dim,
00100             GLuint uorder, GLuint vorder);
00101 
00102 
00103 #endif

Generated on Fri May 25 2012 04:18:42 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.