⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mgcquadraticnetwork.h

📁 《3D游戏引擎设计》的源码
💻 H
字号:
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// FREE SOURCE CODE
// http://www.magic-software.com/License/free.pdf

#ifndef MGCQUADRATICNETWORK_H
#define MGCQUADRATICNETWORK_H

// Quadratic interpolation of a network of triangles whose vertices are of
// the form (x,y,f(x,y)).  This code is an implementation of the algorithm
// found in
//
//   Zoltan J. Cendes and Steven H. Wong,
//   C1 quadratic interpolation over arbitrary point sets,
//   IEEE Computer Graphics & Applications,
//   pp. 8-16, 1987

#include "MgcTriangleNetwork.h"


class MgcQuadraticNetwork : public MgcTriangleNetwork
{
public:
    // Construction and destruction.
    //
    // The first two constructors implicitly create the triangle network from
    // the input vertices.  Each constructor accepts ownership of the input
    // arrays and will delete them during destruction.  The underlying
    // triangle network object also will be deleted.  The application must
    // specify the function F and its derivatives Fx and Fy at the spatial
    // locations.
    //
    // The last two constructors share the input triangle network.  Each
    // constructor accepts ownership of the input function array, but does
    // not delete the triangle network on destruction.  The idea is that the
    // network was shared, either from an explicitly created one by the
    // application or from one created by another interpolator.  The
    // application must specify the function F at the spatial locations.  The
    // derivatives Fx and Fy will be estimated.

    MgcQuadraticNetwork (int iVertexQuantity, MgcVector2* akVertex,
        MgcReal* afF, MgcReal* afFx, MgcReal* afFy);

    MgcQuadraticNetwork (int iVertexQuantity, MgcVector2* akVertex,
        MgcReal* afF);

    MgcQuadraticNetwork (MgcTriangleNetwork& rkNet, MgcReal* afF,
        MgcReal* afFx, MgcReal* afFy);

    MgcQuadraticNetwork (MgcTriangleNetwork& rkNet, MgcReal* afF);

    virtual ~MgcQuadraticNetwork ();

    // Quadratic interpolation.  The return value is 'true' if and only if the
    // input point is in the convex hull of the input vertices, in which case
    // the interpolation is valid.
    bool Evaluate (const MgcVector2& rkPoint, MgcReal& rfF, MgcReal& rfFx,
        MgcReal& rfFy);

protected:
    class TriangleData
    {
    public:
        MgcVector2 m_kCenter;
        MgcVector2 m_akIntersect[3];
        MgcReal m_afCoeff[19];
    };

    class Jet
    {
    public:
        MgcReal m_fF, m_fFx, m_fFy;
    };

    MgcReal* m_afF;
    MgcReal* m_afFx;
    MgcReal* m_afFy;
    TriangleData* m_akTData;  // triangle data
    MgcVector2* m_akECenter;  // extra triangle centers

    void EstimateDerivatives ();
    void ProcessTriangles ();
    void ComputeCrossEdgeIntersections (int iT);
    void ComputeCoefficients (int iT);
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -