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

📄 cylinder.h

📁 一个纹理地形渲染器
💻 H
字号:
// Cylinder primitive

#pragma once

#include "Vector.h"
#include "Matrix.h"


namespace Mathematics
{
    /// A cylinder solid.
    /// Defined as two points in 3-space and a radius.
    /// Radius squared is calculated and stored for later use.

    class Cylinder
    {
    public:

        /// default constructor.
        /// does nothing for speed

        Cylinder() {};

        /// construct a cylinder from end points and radius.

	    Cylinder(const Vector &a, const Vector &b, float radius)
	    {
		    this->a = a;
		    this->b = b;
		    this->radius = radius;
		    this->radiusSquared = radius * radius;
	    }

        /// construct a cylinder from end points, radius and radius squared.
        /// note: use this method if time is critical and you already have radius
        /// squared pre-calculated.

        Cylinder(const Vector &a, const Vector &b, float radius, float radiusSquared)
	    {
		    this->a = a;
		    this->b = b;
		    this->radius = radius;
		    this->radiusSquared = radiusSquared;
	    }

		/// calculate center of cylinder

		Vector center() const
		{
			return (a+b)*0.5f;
		}

        Vector a;				///< first end point
        Vector b;				///< second end point
        float radius;			///< radius of sphere
        float radiusSquared;    ///< radius of sphere squared
    };
}

⌨️ 快捷键说明

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