IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Flash Discussion :

une face de mon cube ne se dessine pas


Sujet :

Flash

  1. #1
    Nouveau membre du Club
    Inscrit en
    Août 2006
    Messages
    41
    Détails du profil
    Informations forums :
    Inscription : Août 2006
    Messages : 41
    Points : 30
    Points
    30
    Par défaut une face de mon cube ne se dessine pas
    Hola flasheurs.

    voila, j'ai un pavé dessiné en 3D par du code. je voudrais l'avoir dans une position particulière. pour cela je lui applique une série de rotations définies aussi dans mon code. Quand j'applique les rotations, il me redessine mon pavé, mais il oublie une face!!!! si ensuite je clique sur un bouton créé pour faire une rotation pas à pas, la face se dessine. Mais au final, je ne veux pas de ce bouton. Je veux que à la compilation de ma séquence la face soit déssinée.
    D'ou vient le problème?

    Je vous joins 2 sources: la première c'est mon pavé qui marche pas, et la deuxième c'est le même code, excepté que le pavé tourne en fonction de la souris (pour que vous voyez que la face se dessine normalement !!)

    merci de votre réponse
    Fichiers attachés Fichiers attachés

  2. #2
    Membre émérite
    Avatar de jean philippe
    Profil pro
    Inscrit en
    Septembre 2006
    Messages
    2 062
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2006
    Messages : 2 062
    Points : 2 313
    Points
    2 313
    Par défaut
    salut
    je comprends pas trop le prob
    j'ai changé 2 ou 3 trucs et la forme 3D se dessine dans l'angle que j'ai choisi (j'ai rajouté un argument dans la function refresh).
    voici le code modifié
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    //initilisation
    for (i=1; i<=6; i++) {
    	this.createEmptyMovieClip("face"+i, i);
    }
    //constructeur
    function Vector3d(x, y, z) {
    	this.x = x;
    	this.y = y;
    	this.z = z;
    }
    //methodes
    Vector3d.prototype.rotateXY = function(ca, sa, cb, sb) {
    	with (this) {
    		var rz = y*sa+z*ca;
    		y = y*ca-z*sa;
    		z = x*(-sb)+rz*cb;
    		x = x*cb+rz*sb;
    	}
    };
    //methode de calcul des coordonnées pour les rotations x et y
    Vector3d.prototype.rotateX = function(ca, sa) {
    	with (this) {
    		var temp = y;
    		y = temp*ca-z*sa;
    		z = temp*sa+z*ca;
    	}
    };
    Vector3d.prototype.rotateY = function(ca, sa) {
    	with (this) {
    		var temp = z;
    		z = temp*ca-x*sa;
    		x = temp*sa+x*ca;
    	}
    };
    Vector3d.prototype.rotateZ = function(ca, sa) {
    	with (this) {
    		var temp = y;
    		y = temp*ca+x*sa;
    		x = -temp*sa+x*ca;
    	}
    };
    Vector3d.prototype.transy = function(pas) {
    	with (this) {
    		this.y = y+pas;
    	}
    };
    Vector3d.prototype.transx = function(pas) {
    	with (this) {
    		this.x = x+pas;
    	}
    };
    Vector3d.prototype.transz = function(pas) {
    	with (this) {
    		this.z = z+pas;
    	}
    };
    //fonction de rafraichissement
    function refresh(deg) {
    	cosa = Math.cos((deg*Math.PI)/180);
    	sina = Math.sin((deg*Math.PI)/180);
    	cosb = Math.cos((-deg*Math.PI)/180);
    	sinb = Math.sin((-deg*Math.PI)/180);
    	points[0].rotateXY(cosa, sina, cosb, sinb);
    	points[1].rotateXY(cosa, sina, cosb, sinb);
    	points[2].rotateXY(cosa, sina, cosb, sinb);
    	points[3].rotateXY(cosa, sina, cosb, sinb);
    	points[4].rotateXY(cosa, sina, cosb, sinb);
    	points[5].rotateXY(cosa, sina, cosb, sinb);
    	points[6].rotateXY(cosa, sina, cosb, sinb);
    	points[7].rotateXY(cosa, sina, cosb, sinb);
    	milieux[0].rotateXY(cosa, sina, cosb, sinb);
    	milieux[1].rotateXY(cosa, sina, cosb, sinb);
    	milieux[2].rotateXY(cosa, sina, cosb, sinb);
    	milieux[3].rotateXY(cosa, sina, cosb, sinb);
    	milieux[4].rotateXY(cosa, sina, cosb, sinb);
    	milieux[5].rotateXY(cosa, sina, cosb, sinb);
    	//application de la méthode de rotation aux points
    	for (i=0; i<2*nb_faces; i++) {
    		_root.viewer.pointsd[i].rotateXY(cosa, sina, cosb, sinb);
    		_root.viewer.pointsg[i].rotateXY(cosa, sina, cosb, sinb);
    	}
    	//application de la méthode de rotation aux milieux des faces
    	for (i=0; i<nb_faces+2; i++) {
    		_root.viewer.milieuxd[i].rotateXY(cosa, sina, cosb, sinb);
    		_root.viewer.milieuxg[i].rotateXY(cosa, sina, cosb, sinb);
    	}
    	//construction des faces du pavé
    	with (face1) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x999999);
    		moveTo(points[0].x, points[0].y);
    		lineTo(points[1].x, points[1].y);
    		lineTo(points[3].x, points[3].y);
    		lineTo(points[2].x, points[2].y);
    		lineTo(points[0].x, points[0].y);
    		endFill();
    	}
    	with (face2) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x999999);
    		moveTo(points[2].x, points[2].y);
    		lineTo(points[3].x, points[3].y);
    		lineTo(points[5].x, points[5].y);
    		lineTo(points[4].x, points[4].y);
    		lineTo(points[2].x, points[2].y);
    		endFill();
    		moveTo(points[2].x, points[2].y);
    		lineTo(points[5].x, points[5].y);
    	}
    	with (face3) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x999999);
    		moveTo(points[4].x, points[4].y);
    		lineTo(points[5].x, points[5].y);
    		lineTo(points[7].x, points[7].y);
    		lineTo(points[6].x, points[6].y);
    		lineTo(points[4].x, points[4].y);
    		endFill();
    	}
    	with (face4) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x999999);
    		moveTo(points[6].x, points[6].y);
    		lineTo(points[7].x, points[7].y);
    		lineTo(points[1].x, points[1].y);
    		lineTo(points[0].x, points[0].y);
    		lineTo(points[6].x, points[6].y);
    		endFill();
    		moveTo(points[1].x, points[1].y);
    		lineTo(points[6].x, points[6].y);
    	}
    	with (face5) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x999999);
    		moveTo(points[0].x, points[0].y);
    		lineTo(points[2].x, points[2].y);
    		lineTo(points[4].x, points[4].y);
    		lineTo(points[6].x, points[6].y);
    		lineTo(points[0].x, points[0].y);
    		endFill();
    		moveTo(points[0].x, points[0].y);
    		lineTo(points[4].x, points[4].y);
    	}
    	with (face6) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x999999);
    		moveTo(points[1].x, points[1].y);
    		lineTo(points[3].x, points[3].y);
    		lineTo(points[5].x, points[5].y);
    		lineTo(points[7].x, points[7].y);
    		lineTo(points[1].x, points[1].y);
    		endFill();
    		moveTo(points[3].x, points[3].y);
    		lineTo(points[7].x, points[7].y);
    	}
    	//construction des faces des fils à partir des points
    	for (i=1; i<nb_faces; i++) {
    		with (this["faced"+i]) {
    			clear();
    			lineStyle(1, 0x000000);
    			beginFill(0x000000);
    			moveTo(pointsd[i-1].x, pointsd[i-1].y);
    			lineTo(pointsd[i].x, pointsd[i].y);
    			lineTo(pointsd[(nb_faces+i)%(2*nb_faces+1)].x, pointsd[(nb_faces+i)%(2*nb_faces+1)].y);
    			lineTo(pointsd[nb_faces+i-1].x, pointsd[nb_faces+i-1].y);
    			lineTo(pointsd[i-1].x, pointsd[i-1].y);
    			endFill();
    		}
    		with (this["faceg"+i]) {
    			clear();
    			lineStyle(1, 0x000000);
    			beginFill(0x000000);
    			moveTo(pointsg[i-1].x, pointsg[i-1].y);
    			lineTo(pointsg[i].x, pointsg[i].y);
    			lineTo(pointsg[(nb_faces+i)%(2*nb_faces+1)].x, pointsg[(nb_faces+i)%(2*nb_faces+1)].y);
    			lineTo(pointsg[nb_faces+i-1].x, pointsg[nb_faces+i-1].y);
    			lineTo(pointsg[i-1].x, pointsg[i-1].y);
    			endFill();
    		}
    	}
    	with (this["faced"+nb_faces]) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x000000);
    		moveTo(pointsd[nb_faces-1].x, pointsd[nb_faces-1].y);
    		lineTo(pointsd[0].x, pointsd[0].y);
    		lineTo(pointsd[nb_faces].x, pointsd[nb_faces].y);
    		lineTo(pointsd[2*nb_faces-1].x, pointsd[2*nb_faces-1].y);
    		lineTo(pointsd[nb_faces-1].x, pointsd[nb_faces-1].y);
    		endFill();
    	}
    	with (this["faceg"+nb_faces]) {
    		clear();
    		lineStyle(1, 0x000000);
    		beginFill(0x000000);
    		moveTo(pointsg[nb_faces-1].x, pointsg[nb_faces-1].y);
    		lineTo(pointsg[0].x, pointsg[0].y);
    		lineTo(pointsg[nb_faces].x, pointsg[nb_faces].y);
    		lineTo(pointsg[2*nb_faces-1].x, pointsg[2*nb_faces-1].y);
    		lineTo(pointsg[nb_faces-1].x, pointsg[nb_faces-1].y);
    		endFill();
    	}
    	k = 1;
    	for (i=nb_faces+1; i<=nb_faces+2; i++) {
    		indice = nb_faces-k*nb_faces;
    		with (this["faced"+i]) {
    			var indice = nb_faces-k*nb_faces;
    			clear();
    			lineStyle(1, 0x000000);
    			beginFill(0x000000);
    			moveTo(pointsd[indice].x, pointsd[indice].y);
    			for (j=0; j<nb_faces-1; j++) {
    				lineTo(pointsd[indice+j+1].x, pointsd[indice+j+1].y);
    			}
    			lineTo(pointsd[indice].x, pointsd[indice].y);
    			endFill();
    		}
    		with (this["faceg"+i]) {
    			var indice = nb_faces-k*nb_faces;
    			clear();
    			lineStyle(1, 0x000000);
    			beginFill(0x000000);
    			moveTo(pointsg[indice].x, pointsg[indice].y);
    			for (j=0; j<nb_faces-1; j++) {
    				lineTo(pointsg[indice+j+1].x, pointsg[indice+j+1].y);
    			}
    			lineTo(pointsg[indice].x, pointsg[indice].y);
    			endFill();
    		}
    		k = 0;
    	}
    	//gestion des profondeurs en fonction de la position en Z
    	face1.swapDepths(100000-milieux[0].z*100);
    	face2.swapDepths(100000-milieux[1].z*100);
    	face3.swapDepths(100000-milieux[2].z*100);
    	face4.swapDepths(100000-milieux[3].z*100);
    	face5.swapDepths(100000-milieux[4].z*100);
    	face6.swapDepths(100000-milieux[5].z*100);
    	for (i=1; i<=nb_faces+2; i++) {
    		this["faced"+i].swapDepths(100000-milieuxd[i-1].z*100);
    		this["faceg"+i].swapDepths(100000-milieuxg[i-1].z*100);
    	}
    }
    //variables
    _global.nb_faces = 12;
    var k;
    var indice;
    var Cos_1;
    var Sin_1;
    var param = nb_faces/4;
    var angle = 360/nb_faces;
    var angle_opp = (180-(param/8)*angle)/2;
    var rayon = 20;
    var profond = 100;
    var z_origine = -profond/2;
    points = new Array();
    milieux = new Array();
    var profondd = 40;
    var rayond = 5;
    var z_origined = profond/2;
    var longd = 2*rayond*Cos_1;
    pointsd = new Array();
    milieuxd = new Array();
    var profondg = 40;
    var rayong = 5;
    var z_origineg = -profond/2-profondg;
    var longg = 2*rayong*Cos_1;
    pointsg = new Array();
    milieuxg = new Array();
    //initilisation des faces
    for (i=1; i<=nb_faces+2; i++) {
    	this.createEmptyMovieClip("faced"+i, i+100);
    	this.createEmptyMovieClip("faceg"+i, i+200);
    }
    //création des points
    points[0] = new Vector3d(-rayon, -rayon, z_origine);
    points[1] = new Vector3d(-rayon, rayon, z_origine);
    points[2] = new Vector3d(rayon, -rayon, z_origine);
    points[3] = new Vector3d(rayon, rayon, z_origine);
    points[4] = new Vector3d(rayon, -rayon, z_origine+profond);
    points[5] = new Vector3d(rayon, rayon, z_origine+profond);
    points[6] = new Vector3d(-rayon, -rayon, z_origine+profond);
    points[7] = new Vector3d(-rayon, rayon, z_origine+profond);
    /*
    milieux[0]=mid0123=face1
    milieux[1]=mid2345=face2
    milieux[2]=mid4567=face3
    milieux[3]=mid6701=face4
    milieux[4]=mid0246=face5
    milieux[5]=mid1357=face6
    */
    milieux[0] = new Vector3d(0, 0, z_origine);
    milieux[1] = new Vector3d(rayon, 0, 0);
    milieux[2] = new Vector3d(0, 0, z_origine+profond);
    milieux[3] = new Vector3d(-rayon, 0, 0);
    milieux[4] = new Vector3d(0, -rayon, 0);
    milieux[5] = new Vector3d(0, rayon, 0);
    //création des points
    //fil droit
    pointsd[0] = new Vector3d(rayond, 0, z_origined);
    pointsd[0.5*param] = new Vector3d(rayond/2+longd, rayond/2+longd, z_origined);
    pointsd[param] = new Vector3d(0, rayond, z_origined);
    pointsd[1.5*param] = new Vector3d(-rayond/2-longd, rayond/2+longd, z_origined);
    pointsd[2*param] = new Vector3d(-rayond, 0, z_origined);
    pointsd[2.5*param] = new Vector3d(-rayond/2-longd, -rayond/2-longd, z_origined);
    pointsd[3*param] = new Vector3d(0, -rayond, z_origined);
    pointsd[3.5*param] = new Vector3d(rayond/2+longd, -rayond/2-longd, z_origined);
    pointsd[nb_faces+0] = new Vector3d(rayond, 0, profondd+z_origined);
    pointsd[nb_faces+0.5*param] = new Vector3d(rayond/2+longd, rayond/2+longd, profondd+z_origined);
    pointsd[nb_faces+param] = new Vector3d(0, rayond, profondd+z_origined);
    pointsd[nb_faces+1.5*param] = new Vector3d(-rayond/2-longd, rayond/2+longd, profondd+z_origined);
    pointsd[nb_faces+2*param] = new Vector3d(-rayond, 0, profondd+z_origined);
    pointsd[nb_faces+2.5*param] = new Vector3d(-rayond/2-longd, -rayond/2-longd, profondd+z_origined);
    pointsd[nb_faces+3*param] = new Vector3d(0, -rayond, profondd+z_origined);
    pointsd[nb_faces+3.5*param] = new Vector3d(rayond/2+longd, -rayond/2-longd, profondd+z_origined);
    //fil gauche
    pointsg[0] = new Vector3d(rayong, 0, z_origineg);
    pointsg[0.5*param] = new Vector3d(rayong/2+longg, rayong/2+longg, z_origineg);
    pointsg[param] = new Vector3d(0, rayong, z_origineg);
    pointsg[1.5*param] = new Vector3d(-rayong/2-longg, rayong/2+longg, z_origineg);
    pointsg[2*param] = new Vector3d(-rayong, 0, z_origineg);
    pointsg[2.5*param] = new Vector3d(-rayong/2-longg, -rayong/2-longg, z_origineg);
    pointsg[3*param] = new Vector3d(0, -rayong, z_origineg);
    pointsg[3.5*param] = new Vector3d(rayong/2+longg, -rayong/2-longg, z_origineg);
    pointsg[nb_faces+0] = new Vector3d(rayong, 0, profondg+z_origineg);
    pointsg[nb_faces+0.5*param] = new Vector3d(rayong/2+longg, rayong/2+longg, profondg+z_origineg);
    pointsg[nb_faces+param] = new Vector3d(0, rayong, profondg+z_origineg);
    pointsg[nb_faces+1.5*param] = new Vector3d(-rayong/2-longg, rayong/2+longg, profondg+z_origineg);
    pointsg[nb_faces+2*param] = new Vector3d(-rayong, 0, profondg+z_origineg);
    pointsg[nb_faces+2.5*param] = new Vector3d(-rayong/2-longg, -rayong/2-longg, profondg+z_origineg);
    pointsg[nb_faces+3*param] = new Vector3d(0, -rayong, profondg+z_origineg);
    pointsg[nb_faces+3.5*param] = new Vector3d(rayong/2+longg, -rayong/2-longg, profondg+z_origineg);
    for (i=1; i<param/2; i++) {
    	angle_opp = (180-i*angle)/2;
    	Cos_1 = Math.cos(angle_opp*Math.PI/180);
    	Sin_1 = Math.sin(angle_opp*Math.PI/180);
    	longd = 2*Math.abs(pointsd[i-1].x)*Cos_1;
    	longg = 2*Math.abs(pointsg[i-1].x)*Cos_1;
    	pointsd[i] = new Vector3d(pointsd[0].x-longd*Cos_1, pointsd[0].y+longd*Sin_1, z_origined);
    	pointsd[param-i] = new Vector3d(pointsd[0].y+longd*Sin_1, pointsd[0].x-longd*Cos_1, z_origined);
    	pointsd[param+i] = new Vector3d(pointsd[0].y-longd*Sin_1, pointsd[0].x-longd*Cos_1, z_origined);
    	pointsd[2*param-i] = new Vector3d(-pointsd[0].x+longd*Cos_1, pointsd[0].y+longd*Sin_1, z_origined);
    	pointsd[2*param+i] = new Vector3d(-pointsd[0].x+longd*Cos_1, pointsd[0].y-longd*Sin_1, z_origined);
    	pointsd[3*param-i] = new Vector3d(-pointsd[0].y-longd*Sin_1, -pointsd[0].x+longd*Cos_1, z_origined);
    	pointsd[3*param+i] = new Vector3d(-pointsd[0].y+longd*Sin_1, -pointsd[0].x+longd*Cos_1, z_origined);
    	pointsd[nb_faces-i] = new Vector3d(pointsd[0].x-longd*Cos_1, pointsd[0].y-longd*Sin_1, z_origined);
    	pointsd[nb_faces+i] = new Vector3d(pointsd[0].x-longd*Cos_1, pointsd[0].y+longd*Sin_1, profondd+z_origined);
    	pointsd[nb_faces+param-i] = new Vector3d(pointsd[0].y+longd*Sin_1, pointsd[0].x-longd*Cos_1, profondd+z_origined);
    	pointsd[nb_faces+param+i] = new Vector3d(pointsd[0].y-longd*Sin_1, pointsd[0].x-longd*Cos_1, profondd+z_origined);
    	pointsd[nb_faces+2*param-i] = new Vector3d(-pointsd[0].x+longd*Cos_1, pointsd[0].y+longd*Sin_1, profondd+z_origined);
    	pointsd[nb_faces+2*param+i] = new Vector3d(-pointsd[0].x+longd*Cos_1, pointsd[0].y-longd*Sin_1, profondd+z_origined);
    	pointsd[nb_faces+3*param-i] = new Vector3d(-pointsd[0].y-longd*Sin_1, -pointsd[0].x+longd*Cos_1, profondd+z_origined);
    	pointsd[nb_faces+3*param+i] = new Vector3d(-pointsd[0].y+longd*Sin_1, -pointsd[0].x+longd*Cos_1, profondd+z_origined);
    	pointsd[nb_faces+nb_faces-i] = new Vector3d(pointsd[0].x-longd*Cos_1, pointsd[0].y-longd*Sin_1, profondd+z_origined);
    	pointsg[i] = new Vector3d(pointsg[0].x-longg*Cos_1, pointsg[0].y+longg*Sin_1, z_origineg);
    	pointsg[param-i] = new Vector3d(pointsg[0].y+longg*Sin_1, pointsg[0].x-longg*Cos_1, z_origineg);
    	pointsg[param+i] = new Vector3d(pointsg[0].y-longg*Sin_1, pointsg[0].x-longg*Cos_1, z_origineg);
    	pointsg[2*param-i] = new Vector3d(-pointsg[0].x+longg*Cos_1, pointsg[0].y+longg*Sin_1, z_origineg);
    	pointsg[2*param+i] = new Vector3d(-pointsg[0].x+longg*Cos_1, pointsg[0].y-longg*Sin_1, z_origineg);
    	pointsg[3*param-i] = new Vector3d(-pointsg[0].y-longg*Sin_1, -pointsg[0].x+longg*Cos_1, z_origineg);
    	pointsg[3*param+i] = new Vector3d(-pointsg[0].y+longg*Sin_1, -pointsg[0].x+longg*Cos_1, z_origineg);
    	pointsg[nb_faces-i] = new Vector3d(pointsg[0].x-longg*Cos_1, pointsg[0].y-longg*Sin_1, z_origineg);
    	pointsg[nb_faces+i] = new Vector3d(pointsg[0].x-longg*Cos_1, pointsg[0].y+longg*Sin_1, profondg+z_origineg);
    	pointsg[nb_faces+param-i] = new Vector3d(pointsg[0].y+longg*Sin_1, pointsg[0].x-longg*Cos_1, profondg+z_origineg);
    	pointsg[nb_faces+param+i] = new Vector3d(pointsg[0].y-longg*Sin_1, pointsg[0].x-longg*Cos_1, profondg+z_origineg);
    	pointsg[nb_faces+2*param-i] = new Vector3d(-pointsg[0].x+longg*Cos_1, pointsg[0].y+longg*Sin_1, profondg+z_origineg);
    	pointsg[nb_faces+2*param+i] = new Vector3d(-pointsg[0].x+longg*Cos_1, pointsg[0].y-longg*Sin_1, profondg+z_origineg);
    	pointsg[nb_faces+3*param-i] = new Vector3d(-pointsg[0].y-longg*Sin_1, -pointsg[0].x+longg*Cos_1, profondg+z_origineg);
    	pointsg[nb_faces+3*param+i] = new Vector3d(-pointsg[0].y+longg*Sin_1, -pointsg[0].x+longg*Cos_1, profondg+z_origineg);
    	pointsg[nb_faces+nb_faces-i] = new Vector3d(pointsg[0].x-longg*Cos_1, pointsg[0].y-longg*Sin_1, profondg+z_origineg);
    }
    //calcul des coordonnées des milieux des faces
    for (i=0; i<nb_faces-1; i++) {
    	milieuxd[i] = new Vector3d(pointsd[i+1].x/2, pointsd[i+1].y/2, profondd/2+z_origined);
    	milieuxg[i] = new Vector3d(pointsg[i+1].x/2, pointsg[i+1].y/2, profondg/2+z_origineg);
    }
    milieuxd[nb_faces-1] = new Vector3d((pointsd[0].x+pointsd[nb_faces-1].x)/2, (pointsd[0].y+pointsd[nb_faces-1].y)/2, profondd/2+z_origined);
    milieuxd[nb_faces] = new Vector3d(0, 0, z_origined);
    milieuxd[nb_faces+1] = new Vector3d(0, 0, profondd+z_origined);
    milieuxg[nb_faces-1] = new Vector3d((pointsg[0].x+pointsg[nb_faces-1].x)/2, (pointsg[0].y+pointsg[nb_faces-1].y)/2, profondg/2+z_origineg);
    milieuxg[nb_faces] = new Vector3d(0, 0, z_origineg);
    milieuxg[nb_faces+1] = new Vector3d(0, 0, profondg+z_origineg);
    cosa = Math.cos((Math.PI/2)/180*90);
    sina = Math.sin((Math.PI/2)/180*90);
    //application de la méthode de rotation aux points
    for (i=0; i<2*nb_faces; i++) {
    	this.pointsd[i].rotateX(cosa, sina);
    	this.pointsg[i].rotateX(cosa, sina);
    	this.pointsd[i].rotateY(cosa, sina);
    	this.pointsg[i].rotateY(cosa, sina);
    	this.pointsd[i].rotateX(cosa, -sina);
    	this.pointsg[i].rotateX(cosa, -sina);
    }
    for (i=0; i<8; i++) {
    	this.points[i].rotateX(cosa, sina);
    	this.points[i].rotateY(cosa, sina);
    	this.points[i].rotateX(cosa, -sina);
    }
    //application de la méthode de rotation aux milieux des faces
    for (i=0; i<nb_faces+2; i++) {
    	this.milieuxd[i].rotateX(cosa, sina);
    	this.milieuxg[i].rotateX(cosa, sina);
    	this.milieuxd[i].rotateY(cosa, sina);
    	this.milieuxg[i].rotateY(cosa, sina);
    	this.milieuxd[i].rotateX(cosa, -sina);
    	this.milieuxg[i].rotateX(cosa, -sina);
    }
    for (i=0; i<6; i++) {
    	this.milieux[i].rotateX(cosa, sina);
    	this.milieux[i].rotateY(cosa, sina);
    	this.milieux[i].rotateX(cosa, -sina);
    }
    //visualisation
    refresh(30);
    je te joins le fla modifié

  3. #3
    Nouveau membre du Club
    Inscrit en
    Août 2006
    Messages
    41
    Détails du profil
    Informations forums :
    Inscription : Août 2006
    Messages : 41
    Points : 30
    Points
    30
    Par défaut
    Regarde bien le code que tu m'as donné ou le mien. Quand tu le compile, tu vois le pavé dessiné, mais la face carrée au premier plan n'est pas déssinée (elle devrait etre pleine comme sur l'autre source que j'ai donnée et donc on ne devrait pas voir les traits des faces du dessous et du coté). La face qui ne se dessine pas s'appelle face1.

Discussions similaires

  1. Réponses: 10
    Dernier message: 25/09/2012, 09h43
  2. une fois publiée, mon mail ne s'envoie pas
    Par Golzinne dans le forum Silverlight
    Réponses: 3
    Dernier message: 02/12/2010, 10h22
  3. Dessiner dans une fenêtre externe à mon application
    Par fatdarron dans le forum Langage
    Réponses: 6
    Dernier message: 15/03/2010, 15h13
  4. Réponses: 0
    Dernier message: 19/02/2009, 11h30
  5. Dessiner une ligne dans un cube transparent ?
    Par Muetdhiver dans le forum OpenGL
    Réponses: 4
    Dernier message: 04/05/2004, 11h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo