cubo-3d

download cubo-3d

of 4

Transcript of cubo-3d

  • 7/25/2019 cubo-3d

    1/4

    #include#include#include#include#include#include

    #define MAXP 16typedef struct tmat{ double !"!"$%$typedef struct tpunto{ double &'y'($ int dib$%$tmat identidad){{{1'*'*'*%'{*'1'*'*%'{*'*'1'*%'{*'*'*'1%%%$tmat mat$tpunto ne+puntos$double persp&$double perspy$double d$tpunto cubo!MAXP){

    {*'*'*'*%'{1**'*'*'1%'{1**'1**'*'1%'{*'1**'*'1%'{*'1**'1**'1%'{1**'1**'1**'1%'{1**'*'1**'1%'{*'*'1**'1%'

    {*'*'*'1%'{*'1**'*'1%'{*'*'1**'*%'{*'1**'1**'1%'{1**'1**'*'*%'{1**'1**'1**'1%'{1**'*'*'*%'{1**'*'1**'1%'

    %$oid aplica,tmat -m'tpunto a'tpunto -b{b/>&)m/>!*!*-a.&0m/>!*!1-a.y0m/>!*!-a.(0m/>!*!2$b/>y)m/>!1!*-a.&0m/>!1!1-a.y0m/>!1!-a.(0m/>!1!2$b/>()m/>!!*-a.&0m/>!!1-a.y0m/>!!-a.(0m/>!!2$%oid multiplica,tmat -a'tmat -b'tmat -c{int i'3'4$for,i)*$i!i!3)*$for,4)*$4

  • 7/25/2019 cubo-3d

    2/4

    oid ie+port,int +'int h{d)5**$persp&)+$perspy)h$%

    oid dibu3ar,oid{int i$double &'y$for,i)*$i

  • 7/25/2019 cubo-3d

    3/4

    %oid trasladar,double t&'double ty'double t({tmat a'b$a)identidad$a.!*!2)t&$

    a.!1!2)ty$a.!!2)t($b)mat$multiplica,7a'7b'7mat$%oid escalar,double s&'double sy'double s({tmat a'b$a)identidad$a.!*!*)s&$a.!1!1)sy$a.!!)s($b)mat$multiplica,7a'7b'7mat$%

    int main,oid{ char opcion$ int gdrier ) :;;=' gmode'i$ double t&'ty't('s&'ang&'angy'ang($ mat)identidad$ initgraph,7gdrier' 7gmode' d?@@borlandc@@bgi$ ie+port,getma&&,'getma&y,$ do{

    dibu3ar,$ opcion)getch,$ cleardeice,$ t&)*'ty)*'s&)1'ang&)*'angy)*'ang()*$ s+itch,opcion

    {case &?ang&)B $brea4$case X?ang&)/B $brea4$case y?angy)B $brea4$case C?angy)/B $brea4$case (?ang()B $brea4$case D?ang()/B $brea4$case d?t&)B $brea4$case a?t&)/B $brea4$case +?ty)B $brea4$case s?ty)/B $brea4$case E?s&)*.B $brea4$case e?s&)1.B $brea4$%escalar,s&'s&'s&$trasladar,t&'ty't($rotar&,ang&$rotary,angy$rotar(,ang($

    %+hile,opcionF)G$

  • 7/25/2019 cubo-3d

    4/4