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

📄 ray.h

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

#pragma once

#include "Vector.h"


namespace Mathematics
{
    /// %Ray from origin point in specified direction

    class Ray
    {
    public:

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

        Ray() {};

		/// construct a ray from given origin and direction.
		/// note: the ray direction must be unit length!

        Ray(const Vector &origin, const Vector &direction)
        {
			assert(direction.normalized());

            this->origin = origin;
            this->direction = direction;
        }

        /// calculate point along ray.

        Vector point(float t) const
        {
            return origin + direction * t;
        }

        Vector origin;          ///< origin of ray
        Vector direction;       ///< direction of ray (always unit length)
    };
}

⌨️ 快捷键说明

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