picturebox.scale with polyline or polygon API function.... ???? 
Author Message
 picturebox.scale with polyline or polygon API function.... ????

hi, please help it is quite URGENT...!

MY AIM :
To make a CAD program. (computer aided design and drafting...)
WHAT I NEED:
A 3d  drawing space with correct coordinates.
Vbasic takes the upper left corner 0,0 and so fort.... i am using
picturebox.scale function
to coorect this problem and make the center of picturebox (0,0) and 4
quadrants like

-x          +x
 +y    |    +y
------|--------
 -x     |   +x
-y          -y

picturebox.line fynction works properly with the current changes..but
Polygon API function does not realise the picturebox.scale command.
picture1.hdc does not affected...PLS HELP
I MAY SEND MY CODE UPON REQUEST.

I am using a simple rotation algo. but as far as i know the algor.. below
takes 0,0 as  referance while rotating. how to modify to make 0,0 ---> my
origion.

Private Sub Rotate3D(x1 As Long, y1 As Long, z1 As Long, yaw As Single, pit
As Single, rol As Single)
  '
  Dim x2 As Long, y2 As Long, z2 As Long
  Dim x3 As Long, y3 As Long, z3 As Long
  Dim x4 As Long, y4 As Long, z4 As Long
  '
  ' Yaw
  '
  x2 = x1 * Cos(yaw) + z1 * Sin(yaw)
  y2 = y1
  z2 = x1 * Sin(yaw) - z1 * Cos(yaw)
  '
  ' Pitch
  '
  x3 = x2
  y3 = y2 * Cos(pit) + z2 * Sin(pit)
  z3 = y2 * Sin(pit) - z2 * Cos(pit)
  '
  ' Roll
  '
  x4 = x3 * Cos(rol) + y3 * Sin(rol)
  y4 = x3 * Sin(rol) - y3 * Cos(rol)
  z4 = z3
  '
  x1 = x4: y1 = y4: z1 = z4
  '
End Sub

THANKS DANKE
Devrim PAKKAN



Tue, 03 Jun 2003 05:43:12 GMT  
 picturebox.scale with polyline or polygon API function.... ????
I cannot help you much, but I have exactly the same problem. The only thing
I can say is that it is better to use set of methods:

with picViewport
    .ScaleLeft = 0
    .ScaleTop = ....
    [...]
End With

instead of picViewport.Scale method. Especially if you want to reverse
coordinates system to be more intuitive it is better to avoid Scale method.

By the way, I am also very interested in what experts have to say on this.

Jarek Kowalczyk



Quote:
> hi, please help it is quite URGENT...!

> MY AIM :
> To make a CAD program. (computer aided design and drafting...)
> WHAT I NEED:
> A 3d  drawing space with correct coordinates.
> Vbasic takes the upper left corner 0,0 and so fort.... i am using
> picturebox.scale function



Tue, 03 Jun 2003 16:14:56 GMT  
 picturebox.scale with polyline or polygon API function.... ????

The API drawing functions work with pixels.  Only and always.  Sometimes
they work Ok when your picturebox ScaleMode is not pixels (but they _still_
work in pixels!).  Sometimes they _require_ that the picturebox ScaleMode =
3.

No problem: just write yourself a little scale translation routine that goes
from your custom coordinates to pixels and vice-versa.  The ScaleMode is
just a convenience: a pair of one-line functions will replace it.   They
could even use the .scale method, though I've always mistrusted it (for no
real reason, seeing as I've never used it....)

Jim Deutch
MS Dev MVP



Quote:
> hi, please help it is quite URGENT...!

> MY AIM :
> To make a CAD program. (computer aided design and drafting...)
> WHAT I NEED:
> A 3d  drawing space with correct coordinates.
> Vbasic takes the upper left corner 0,0 and so fort.... i am using
> picturebox.scale function
> to coorect this problem and make the center of picturebox (0,0) and 4
> quadrants like

> -x          +x
>  +y    |    +y
> ------|--------
>  -x     |   +x
> -y          -y

> picturebox.line fynction works properly with the current changes..but
> Polygon API function does not realise the picturebox.scale command.
> picture1.hdc does not affected...PLS HELP
> I MAY SEND MY CODE UPON REQUEST.

> I am using a simple rotation algo. but as far as i know the algor.. below
> takes 0,0 as  referance while rotating. how to modify to make 0,0 ---> my
> origion.

> Private Sub Rotate3D(x1 As Long, y1 As Long, z1 As Long, yaw As Single,
pit
> As Single, rol As Single)
>   '
>   Dim x2 As Long, y2 As Long, z2 As Long
>   Dim x3 As Long, y3 As Long, z3 As Long
>   Dim x4 As Long, y4 As Long, z4 As Long
>   '
>   ' Yaw
>   '
>   x2 = x1 * Cos(yaw) + z1 * Sin(yaw)
>   y2 = y1
>   z2 = x1 * Sin(yaw) - z1 * Cos(yaw)
>   '
>   ' Pitch
>   '
>   x3 = x2
>   y3 = y2 * Cos(pit) + z2 * Sin(pit)
>   z3 = y2 * Sin(pit) - z2 * Cos(pit)
>   '
>   ' Roll
>   '
>   x4 = x3 * Cos(rol) + y3 * Sin(rol)
>   y4 = x3 * Sin(rol) - y3 * Cos(rol)
>   z4 = z3
>   '
>   x1 = x4: y1 = y4: z1 = z4
>   '
> End Sub

> THANKS DANKE
> Devrim PAKKAN



Wed, 04 Jun 2003 02:00:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. picturebox.scale command with Polyline or Polygon API Call

2. HELP: API Polygon Functions

3. Problems with Polygon API Function

4. Graphics and API functions for scaling/mapping

5. Is there an API function like VB Scale ?

6. gdi32 polyline function questions

7. AutoRedraw issue with Polyline API

8. polyline api problem

9. Q: Can't get DrawText API function to work in picturebox

10. Scaling Picturebox input

11. How to keep picturebox scaling

12. Scale PictureBox vs CommandButton

 

 
Powered by phpBB® Forum Software