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

📄 point.hpp

📁 The goal of this project is to explore the idea of point-based radiosity, which is a shooting radio
💻 HPP
字号:
#if !defined(BRL_POINT_HPP)
#define BRL_POINT_HPP
/*+----------------------------------------------------------------------------
  Ben Landon
  CSCI E-235
  
  Point.hpp - Interface to a class representing a Point with 
  homogeneous coordinates.
  
*/

#include "Vector.hpp"

class Point
{
private:
    float m_x;
    float m_y;
    float m_z;
    float m_w;
    float m_rhw;  // reciprocal of w

    void perspective_divide (void);

public:
    float inline x(void) const {return m_x;}
    float inline y(void) const {return m_y;}
    float inline z(void) const {return m_z;}
    float inline w(void) const {return m_w;}

    // Should rhw be associated with Point or 
    // with Vertex.
    float inline rhw(void) const {return m_rhw;}

    Point (float x, float y, float z);
    Point (float x, float y, float z, float w);

    Point (const Point& point);
    Point (void);
    ~Point ();
  
    void set_coordinates (float x, float y, float z, float w = 1.0);
    void set_coordinates (float x, float y, float z, float w, float rhw);
    void set (float x, float y, float z, float w = 1.0) { this->set_coordinates(x, y, z, w); }
    const Point& operator= (const Point& pt);
  
    // Subtracting two Points yields a Vector.    
    Vector operator- (const Point& point) const;

    //Subtracting a vector from a point yields another point.
    Point operator- (const Vector& vec) const;

    // Adding a point and a vector yields a point.
    Point operator+ (const Vector& vec) const;    

    static Point interpolate (const Point& A, float t, const Point& B);
};
#endif

⌨️ 快捷键说明

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