示例#1
0
Plane* Plane_Constructor_Vect(Vect *normal, double distance, Color *color)
{
    Plane *p;
    if((p=(Plane*)malloc(sizeof(Plane)))==NULL) return NULL;
    if ((normal==NULL) || (color==NULL) ) return NULL;
    p->object=Object_Constructor();
    p->normal=normal;
    p->color=color;
    p->Plane_init=Plane_init;
    p->Plane_init(p);
    p->distance=distance;
    return p;
}
示例#2
0
Plane* Plane_Constructor()
{
    Plane *p;
    if((p=(Plane*)malloc(sizeof(Plane)))==NULL) return NULL;
    p->object=Object_Constructor();
    p->normal=Vect_Constructor();
    p->color=Color_Constructor();
    p->Plane_init=Plane_init;
    p->Plane_init(p);
    p->normal->setValue_vect(p->normal, 1, 0, 0);
    p->color->setValue_color(p->color,0.5, 0.5, 0.5, 0);
    p->distance=0.0;
    return p;
}