|
Plus ou moins ^^
En fait, c'est pas l'algo qui m'embête, c'est l'ordi qui veut pas le comprendre ^^
y'a une erreur là dedans je crois (c'est assez moche hein, j'ai pas eu le temps de reprendre le programme pour lui donner plus "d'élégance"):
let rec auxeclairementparcoursobjet (point : point) (listobjet : objet list) (pt: point) (intensite: float) = let droite = (point, normalisation (addvect pt (multvect( -.1.) point))) in match listobjet with |[]-> intensite |Plan plan :: q -> begin match intersectiondroiteplan droite plan with |Unpoint(point,_,_,_) -> auxeclairementparcoursobjet point q pt intensite |Unpoint(_,a,_,_) when a <= 0. -> auxeclairementparcoursobjet point q pt intensite |_ -> 0. end |Sphere sphere :: q -> begin match intersectiondroitesphere droite sphere with | Unpoint(point,_,_,_) -> auxeclairementparcoursobjet point q pt intensite | Deuxpoints ((point,_,_,_),(_,a,_,_)) when a <= 0. -> auxeclairementparcoursobjet point q pt intensite | Deuxpoints ((_,a,_,_),(point,_,_,_)) when a <= 0. -> auxeclairementparcoursobjet point q pt intensite | Deuxpoints ((_,a,_,_),(_,b,_,_)) when a <= 0. && b<=0. -> auxeclairementparcoursobjet point q pt intensite | Unpoint (_,a,_,_) when a <= 0. -> auxeclairementparcoursobjet point q pt intensite |_ -> 0. end ;;
_________________
Quelques liens utiles :
Pour les interventions gmiques ponctuelles, c'est ici. Et pour toutes question, c'est là.
|