本文整理汇总了C++中Point3D函数的典型用法代码示例。如果您正苦于以下问题:C++ Point3D函数的具体用法?C++ Point3D怎么用?C++ Point3D使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Point3D函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Point3D
#include "Draw2D.h"
#include <math.h>
#define PI 3.14
Point3D Draw2D::camera = Point3D(225.000000, 225.000000, 1200.000000);
//Point3D Draw2D::camera = Point3D(0.000000, 0.000000, 0.000000);
Point2D Draw2D::center(640/2,480/2);
float Draw2D::xangle = 0;
float Draw2D::yangle = 0;
float Draw2D::zangle = 0;
float Draw2D::far = -300;
float Draw2D::near = -10.0;
float Draw2D::f = 320;
float Draw2D::dx = 1;
float Draw2D::dy = 1;
float Draw2D::miniLine = 0.9;
void Draw2D::drawSegment(SDL_Surface *screen,int x0, int y0, int x1, int y1, Uint8 r, Uint8 g, Uint8 b)
{
int dx = abs(x1-x0);
int dy = abs(y1-y0);
int sx,sy;
if (x0 < x1)
{
sx = 1 ;
}else{
sx = -1;
示例2: Point3D
inline Point3D operator -(const Point3D& a, const Vector3D& b)
{
return Point3D(a[0]-b[0], a[1]-b[1], a[2]-b[2]);
}
示例3: CFlightVisualiser
CFlightVisualiser::CFlightVisualiser(QWidget *parent) :
CFlightVisualiser(parent, Point3D(100, 100, 100), Point2D(100, 250), Point3D(500, 500, 500), Vector3D(Grad(0), Grad(0)))
{
}
示例4: RayCast
void
World::build(void) {
int num_samples = 16;
vp.set_hres(600);
vp.set_vres(600);
vp.set_pixel_size(0.5);
vp.set_samples(num_samples);
// vp.set_gamut_display(true); // for Figure 14.23(b)
tracer_ptr = new RayCast(this);
Pinhole* pinhole_ptr = new Pinhole;
pinhole_ptr->set_eye(0, 0, 10000);
pinhole_ptr->set_lookat(0.0);
pinhole_ptr->set_view_distance(15000);
pinhole_ptr->compute_uvw();
set_camera(pinhole_ptr);
Directional* light_ptr = new Directional;
light_ptr->set_direction(100, 100, 200);
light_ptr->set_color(1.0, 1.0, 1.0);
light_ptr->scale_radiance(4.5);
add_light(light_ptr);
// colors
RGBColor yellow(1, 1, 0); // yellow
RGBColor brown(0.71, 0.40, 0.16); // brown
RGBColor dark_green(0.0, 0.41, 0.41); // dark_green
RGBColor orange(1, 0.75, 0); // orange
RGBColor green(0, 0.6, 0.3); // green
RGBColor light_green(0.65, 1, 0.30); // light green
RGBColor dark_yellow(0.61, 0.61, 0); // dark yellow
RGBColor light_purple(0.65, 0.3, 1); // light purple
RGBColor dark_purple(0.5, 0, 1); // dark purple
// Matt material reflection coefficients
float ka = 0.25;
float kd = 0.75;
// spheres
Matte* matte_ptr1 = new Matte;
matte_ptr1->set_ka(ka);
matte_ptr1->set_kd(kd);
matte_ptr1->set_cd(yellow);
Sphere* sphere_ptr1 = new Sphere(Point3D(5, 3, 0), 30);
sphere_ptr1->set_material(matte_ptr1); // yellow
add_object(sphere_ptr1);
Matte* matte_ptr2 = new Matte;
matte_ptr2->set_ka(ka);
matte_ptr2->set_kd(kd);
matte_ptr2->set_cd(brown);
Sphere* sphere_ptr2 = new Sphere(Point3D(45, -7, -60), 20);
sphere_ptr2->set_material(matte_ptr2); // brown
add_object(sphere_ptr2);
Matte* matte_ptr3 = new Matte;
matte_ptr3->set_ka(ka);
matte_ptr3->set_kd(kd);
matte_ptr3->set_cd(dark_green);
Sphere* sphere_ptr3 = new Sphere(Point3D(40, 43, -100), 17);
sphere_ptr3->set_material(matte_ptr3); // dark green
add_object(sphere_ptr3);
Matte* matte_ptr4 = new Matte;
matte_ptr4->set_ka(ka);
matte_ptr4->set_kd(kd);
matte_ptr4->set_cd(orange);
Sphere* sphere_ptr4 = new Sphere(Point3D(-20, 28, -15), 20);
sphere_ptr4->set_material(matte_ptr4); // orange
add_object(sphere_ptr4);
Matte* matte_ptr5 = new Matte;
matte_ptr5->set_ka(ka);
matte_ptr5->set_kd(kd);
matte_ptr5->set_cd(green);
Sphere* sphere_ptr5 = new Sphere(Point3D(-25, -7, -35), 27);
sphere_ptr5->set_material(matte_ptr5); // green
add_object(sphere_ptr5);
Matte* matte_ptr6 = new Matte;
matte_ptr6->set_ka(ka);
matte_ptr6->set_kd(kd);
matte_ptr6->set_cd(light_green);
Sphere* sphere_ptr6 = new Sphere(Point3D(20, -27, -35), 25);
sphere_ptr6->set_material(matte_ptr6); // light green
add_object(sphere_ptr6);
Matte* matte_ptr7 = new Matte;
matte_ptr7->set_ka(ka);
matte_ptr7->set_kd(kd);
matte_ptr7->set_cd(green);
//.........这里部分代码省略.........
示例5: Point3D
Point3D RaySpotLight::transparency(RayIntersectionInfo& iInfo,RayShape* shape,Point3D cLimit){
return Point3D(1,1,1);
}
示例6: mNumParticles
ParticleSystem::ParticleSystem() :
mNumParticles( 0.0 ),
mOrigin( Point3D() ),
mBaseVelocity( Vector3D() ),
mBaseSize( 1.0 )
{}
示例7: Point3D
Point3D operator +(const Point3D& u, const Vector3D& v){
return Point3D(u[0]+v[0], u[1]+v[1], u[2]+v[2]);
}
示例8: AllDirections
Point3D AllDirections()
{
int a = rand() % 100-50, b = (rand() % 100 - 50) / 200.0, c = rand() % 100-50;
return Point3D(a*1.0, b*1.0, c*1.0).Normalize();
}
示例9: DefaultTranslation
Point3D DefaultTranslation() {
return Point3D(0.0, 0.0, 0.0);
}
示例10: Translation
Point3D Translation() {
return Point3D(rand() % 5, rand() % 5, 0.0);
}
示例11: BoxPosition
Point3D BoxPosition() {
int a = rand() % 100-50, b = rand() % 100-50, c = rand() % 100 - 50;
return Point3D(a*1.0, b*1.0, c*1.0).Normalize();
}
示例12: NoDirection
Point3D NoDirection()
{
return Point3D(0.0, 0.0, 0.0).Normalize();
}
示例13: Planar
Point3D Planar()
{
int a = rand() % 100-50, b = rand() % 100-50;
return Point3D(0.0, 0.0, 0.0).Normalize();
}
示例14: main
int main(int argc, char* argv[])
{
// Build your scene and setup your camera here, by calling
// functions from Raytracer. The code here sets up an example
// scene and renders it from two different view points, DO NOT
// change this if you're just implementing part one of the
// assignment.
Raytracer raytracer;
int width = 320;
int height = 240;
if (argc == 3) {
width = atoi(argv[1]);
height = atoi(argv[2]);
}
/***********************************************************Testing ********************************
// Camera parameters.
Point3D eye(0, 0, 1);
Vector3D view(0, 0, -1);
Vector3D up(0, 1, 0);
double fov = 60;
// Defines a material for shading.
Material gold( Colour(0.3, 0.3, 0.3), Colour(0.75164, 0.60648, 0.22648),
Colour(0.628281, 0.555802, 0.366065),
51.2,0.3,0,NULL );
Material jade( Colour(0, 0, 0), Colour(0.54, 0.89, 0.63),
Colour(0.316228, 0.316228, 0.316228),
12.8,0.3,0,NULL);
// Defines a point light source.
raytracer.addLightSource( new PointLight(Point3D(0.0, 0, 5),
Colour(0.9, 0.9, 0.9) ) );
// Add a unit square into the scene with material mat.
SceneDagNode* sphere = raytracer.addObject( new UnitSphere(), &gold );
SceneDagNode* plane = raytracer.addObject( new UnitSquare(), &jade );
// Apply some transformations to the unit square.
double factor1[3] = { 1.0, 2.0, 1.0 };
double factor2[3] = { 6.0, 6.0, 6.0 };
raytracer.translate(sphere, Vector3D(0, 0, -5));
raytracer.rotate(sphere, 'x', -45);
raytracer.rotate(sphere, 'z', 45);
raytracer.scale(sphere, Point3D(0, 0, 0), factor1);
raytracer.translate(plane, Vector3D(0, 0, -7));
raytracer.rotate(plane, 'z', 45);
raytracer.scale(plane, Point3D(0, 0, 0), factor2);
// Render the scene, feel free to make the image smaller for
// testing purposes.
raytracer.render(width, height, eye, view, up, fov, "view4.bmp");
// Render it from a different point of view.
Point3D eye2(4, 2, 1);
Vector3D view2(-4, -2, -6);
raytracer.render(width, height, eye2, view2, up, fov, "view5.bmp");
***********************************************************Testing ********************************/
/***********************************************************Final Scene********************************/
// Camera parameters.
// Point3D eye(0, 8, -3);
// Vector3D view(0, -1,0);
Point3D eye(0, 0, 1);
Vector3D view(0, 0, -1);
Vector3D up(0, 1, 0);
double fov = 60;
// Defines a material for shading.
Material gold( Colour(0.3, 0.3, 0.3), Colour(0.75164, 0.60648, 0.22648),
Colour(0.628281, 0.555802, 0.366065),
51.2,0.2,NULL);
// Material jade( Colour(0, 0, 0), Colour(0.54, 0.89, 0.63),
// Colour(0.316228, 0.316228, 0.316228),
// 12.8,0.5,NULL);
Material jade( Colour(0, 0, 0), Colour(0.47, 0.576, 0.859),
Colour(0.316228, 0.316228, 0.316228),
12.8,0.5,NULL);
Material red( Colour(0.3, 0.3, 0.3), Colour(1, 0, 0),
Colour(0.628281, 0.555802, 0.366065),
51.2,0.2,NULL);
Material white( Colour(0.3, 0.3, 0.3), Colour(1, 0.8549, 0.7255),
Colour(0.628281, 0.555802, 0.366065),
51.2,0.2,NULL);
Material pink( Colour(0.3, 0.3, 0.3), Colour(0.9412, 0.502, 0.502),
Colour(0.628281, 0.555802, 0.366065),
51.2,0.2,NULL);
Material mirror( Colour(0.0, 0.0, 0.0), Colour(0.0, 0.0, 0.0),
Colour(0.0, 0.0, 0.0),
51.2,1,NULL);
Material glass( Colour(0.3, 0.3, 0.3), Colour(1, 1, 1),
Colour(0.628281, 0.555802, 0.366065),
51.2,0,1,NULL);
glass.R_index = 1.3;
//.........这里部分代码省略.........
示例15: Whitted
//.........这里部分代码省略.........
// glass-air interface
float c = 2;
RGBColor glass_color(0.27*c, 0.49*c, 0.42*c);
RGBColor water_color(0.75, 1, 0.75);
Dielectric* glass_ptr = new Dielectric;
glass_ptr->set_ks(0.5);
glass_ptr->set_exp(8000.0);
glass_ptr->set_eta_in(1.50); // glass
glass_ptr->set_eta_out(1.0); // air
glass_ptr->set_cf_in(glass_color);
glass_ptr->set_cf_out(white);
// water-air interface
Dielectric* water_ptr = new Dielectric;
water_ptr->set_ks(0.5);
water_ptr->set_exp(8000);
water_ptr->set_eta_in(1.33); // water
water_ptr->set_eta_out(1.0); // air
water_ptr->set_cf_in(water_color);
water_ptr->set_cf_out(white);
// water-glass interface
Dielectric* dielectric_ptr = new Dielectric;
dielectric_ptr->set_ks(0.5);
dielectric_ptr->set_exp(8000);
dielectric_ptr->set_eta_in(1.33); // water
dielectric_ptr->set_eta_out(1.5); // glass
dielectric_ptr->set_cf_in(water_color);
dielectric_ptr->set_cf_out(glass_color);
// physical bowl parameters (also the defaults)
double inner_radius = 1.0;
double glass_thickness = 0.1;
double water_depth = 1.25;
double meniscus_radius = 0.05;
double opening_angle = 90.0;
FishBowl* fishbowl_ptr = new FishBowl( inner_radius,
glass_thickness,
water_depth,
meniscus_radius,
opening_angle);
fishbowl_ptr->set_glass_air_material(glass_ptr);
fishbowl_ptr->set_water_air_material(water_ptr);
fishbowl_ptr->set_water_glass_material(dielectric_ptr);
add_object(fishbowl_ptr);
// goldfish
Phong* phong_ptr = new Phong;
phong_ptr->set_ka(0.4);
phong_ptr->set_kd(0.8);
phong_ptr->set_cd(1.0, 0.15, 0.0); // orange
phong_ptr->set_ks(0.5);
phong_ptr->set_cs(1.0, 0.35, 0.0); // orange
phong_ptr->set_exp(50.0);
// phong_ptr->set_shadows(false);
// const char* file_name = "goldfish_low_res.ply"; // for scene design
char* file_name = "goldfish_high_res.ply"; // for production
Grid* grid_ptr = new Grid(new Mesh);
// grid_ptr->read_flat_triangles(file_name);
grid_ptr->read_smooth_triangles(file_name);
grid_ptr->set_material(phong_ptr);
grid_ptr->setup_cells();
Instance* gold_fish_ptr = new Instance(grid_ptr);
gold_fish_ptr->scale(0.03);
gold_fish_ptr->translate(0.5, 0.0, 0.0);
add_object(gold_fish_ptr);
// plane
PlaneChecker* checker_ptr = new PlaneChecker;
checker_ptr->set_size(0.5);
checker_ptr->set_outline_width(0.05);
checker_ptr->set_color1(0.75);
checker_ptr->set_color2(0.75);
checker_ptr->set_outline_color(0.45);
SV_Matte* sv_matte_ptr = new SV_Matte;
sv_matte_ptr->set_ka(0.5);
sv_matte_ptr->set_kd(0.65);
sv_matte_ptr->set_cd(checker_ptr);
Plane* plane_ptr = new Plane(Point3D(0, -1.51, 0), Normal(0, 1, 0));
plane_ptr->set_material(sv_matte_ptr);
add_object(plane_ptr);
}