Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drawing a simple cuboid ??
Message
De
22/03/2003 09:14:03
Fabian Belo
Independent Developer
Argentine
 
 
À
22/03/2003 08:41:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00768890
Message ID:
00768900
Vues:
19
Nice piece of code Jos.

>You need to make sure that (a) your x and y origin is in the desired place on the form and (b) that your x,y, and z lengths can fit in the form area desired. You might need to test for this and scale the lengths to fit within your desired area.
>
>You could also optionally define line drawing colours and styles first.
>
>
>*
>* Draw a cuboid given an x,y, and z length in pixels
>*
>
>
>* Setup x and y origin - bottom left coordinate
>
>nXorg=200
>nYorg=200
>
>
>* Default x,y,z values of cuboid for this example.
>* Probably pass these as your cuboid x,y,z pararemeters
>
>nXlen=50
>nYlen=50
>nZlen=50
>
>
>* Calculate x,y values by which to displace second rectangle by nZlen
>
>nXdis = SQRT( ( nZlen^2 ) / 2 )
>nYdis = nXdis  && assume 45 degree perspective so x displacement = y displacement
>
>
>* Draw the cuboid
>
>WITH THISFORM
>
>
>  * First rectangle
>
>  .Line( nXorg,nYorg,nXorg+nXlen,nYorg )
>  .Line( nXorg,nYorg,nXorg,nYorg-nYlen )
>  .Line( nXorg,nYorg-nYlen,nXorg+nXlen,nYorg-nYlen )
>  .Line( nXorg+nXlen,nYorg,nXorg+nXlen,nYorg-nYlen )
>
>
>  * Second rectangle
>
>  .Line( nXorg+nXdis,nYorg-nYdis,nXorg+nXdis+nXlen,nYorg-nYdis )
>  .Line( nXorg+nXdis,nYorg-nYdis,nXorg+nXdis,nYorg-nYdis-nYlen )
>  .Line( nXorg+nXdis,nYorg-nYdis-nYlen,nXorg+nXdis+nXlen,nYorg-nYdis-nYlen )
>  .Line( nXorg+nXdis+nXlen,nYorg-nYdis,nXorg+nXdis+nXlen,nYorg-nYdis-nYlen )
>
>
>  * Joining lines between two rectangles - bottom
>
>  .Line( nXorg,nYorg,nXorg+nXdis,nYorg-nYdis )
>  .Line( nXorg+nXlen,nYorg,nXorg+nXlen+nXdis,nYorg-nYdis )
>
>
>  * Joining lines between two rectangles - top
>
>  .Line( nXorg,nYorg-nYlen,nXorg+nXdis,nYorg-nYlen-nYdis )
>  .Line( nXorg+nXlen,nYorg-nYlen,nXorg+nXlen+nXdis,nYorg-nYlen-nYdis )
>
>
>ENDWITH
>
>
>PS. I only spent 10 mins on this so it really is a quick and dirty just to show the principle :)
>
>
>
>>Hello everybody !
>>
>>In my application i have have show some data from a measuremet system (roboter)
>>I will receive hight, width and depth from a cuboid and among some other things
>>i have to draw this cuboid in my form.
>>But how to do ????
>>Does anyone know a simple, free activex component that can handle this.
>>Just passing the three values to the componet and draw the cuboid in
>>my form ???
>>I don't need zooming, rotation ....
>>Any simple idea is welcomed.
>>
>>Best regards
>>Albert
"Since I've read that alcohol is bad... I quit reading."
Me


http://www.fabianbelo.com.ar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform