mgcimplicitsurface.h

来自「《3D游戏引擎设计》的源码」· C头文件 代码 · 共 59 行

H
59
字号
// 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 MGCPARAMETRICSURFACE_H
#define MGCPARAMETRICSURFACE_H

#include "MgcMatrix3.h"
#include "MgcSurface.h"


class MgcImplicitSurface : public MgcSurface
{
public:
    // Surface is defined by F(x,y,z) = 0.  In all member functions it is
    // the application's responsibility to ensure that (x,y,z) is a solution
    // to F = 0.

    typedef MgcReal (*Function)(MgcReal,MgcReal,MgcReal);

    MgcImplicitSurface (
        Function oF,       // F(x,y,z) = 0 is the surface
        Function aoDF[3],  // (Fx,Fy,Fz)
        Function aoD2F[6]  // (Fxx,Fxy,Fxz,Fyy,Fyz,Fzz)
    );

    // verify point is on surface
    bool IsOnSurface (MgcReal fX, MgcReal fY, MgcReal fZ,
        MgcReal fTolerance = 1e-06) const;

    // derivatives up to second order
    MgcVector3 GetGradient (MgcReal fX, MgcReal fY, MgcReal fZ) const;
    MgcMatrix3 GetHessian (MgcReal fX, MgcReal fY, MgcReal fZ) const;

    // coordinate frame values
    void GetFrame (MgcReal fX, MgcReal fY, MgcReal fZ, MgcVector3& kTangent0,
        MgcVector3& kTangent1, MgcVector3& kNormal) const;

    // differential geometric quantities
    bool ComputePrincipalCurvatureInfo (MgcReal fX, MgcReal fY, MgcReal fZ,
        MgcReal& rfCurv0, MgcReal& rfCurv1, MgcVector3& rkDir0,
        MgcVector3& rkDir1);

protected:
	Function m_oF;
	Function m_aoDF[3];
	Function m_aoD2F[6];
};

#endif

⌨️ 快捷键说明

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