Author Topic: Hello. Does anyone know how to fix the border between two triangles?  (Read 3359 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. SX0 = 100: SY0 = 100: SX1 = 100: SY1 = 668: sx2 = 1024: sy2 = 0: sx3 = 1024: sy3 = 768
  3. '    SX0             SX2
  4. '
  5. '
  6. '
  7. '    SX1             SX3
  8.     Mx = _MOUSEX: My = _MOUSEY
  9.     StredX = Mx
  10.     CLS
  11.     _MAPTRIANGLE (0, 0)-(0, 768)-(1024, 0), img& TO(SX0, SY0)-(SX1, SY1)-(sx2, sy2), 0, _SMOOTHSTRETCHED
  12.     _MAPTRIANGLE (1024, 768)-(1024, 0)-(0, 768), img& TO(sx3, sy3)-(sx2, sy2)-(SX1, SY1), 0, _SMOOTHSTRETCHED
  13.     _DISPLAY
  14.  

FellippeHeitor

  • Guest
Re: Hello. Does anyone know how to fix the border between two triangles?
« Reply #1 on: June 25, 2018, 01:52:38 pm »
I don't know what border you're talking about, but maybe it's the _SEAMLESS keyword you're after.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. SX0 = 100: SY0 = 100: SX1 = 100: SY1 = 668: sx2 = 1024: sy2 = 0: sx3 = 1024: sy3 = 768
  3. '    SX0             SX2
  4. '
  5. '
  6. '
  7. '    SX1             SX3
  8.     Mx = _MOUSEX: My = _MOUSEY
  9.     StredX = Mx
  10.     CLS
  11.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 768)-(1024, 0), img& TO(SX0, SY0)-(SX1, SY1)-(sx2, sy2), 0, _SMOOTHSTRETCHED
  12.     _MAPTRIANGLE _SEAMLESS(1024, 768)-(1024, 0)-(0, 768), img& TO(sx3, sy3)-(sx2, sy2)-(SX1, SY1), 0, _SMOOTHSTRETCHED
  13.     _DISPLAY
  14.  

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Hello. Does anyone know how to fix the border between two triangles?
« Reply #2 on: June 25, 2018, 02:09:57 pm »
Hi,
 I'm looking for a way how texture this irregular face with a picture without deforming the image on a triangle link. Maybe divide image to more particles.... i try it again.  Thank you.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Hello. Does anyone know how to fix the border between two triangles?
« Reply #3 on: June 25, 2018, 02:52:49 pm »
I found solution :-D

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. img& = _COPYIMAGE(im&, 33)
  3. SX0 = 0: SY0 = 0: SX1 = 0: SY1 = _HEIGHT: sx2 = _WIDTH: sy2 = 0: sx3 = _WIDTH: sy3 = _HEIGHT
  4. DX0 = -2: DY0 = 2: DX1 = -2: DY1 = -2: DX2 = 2: DY2 = 2: DX3 = 2: DY3 = -2
  5.  
  6. '    SX0             SX2                                                                    y
  7. '    dx0                                   X left = -   right = +                 - x      -z       +x
  8. '                                          Y dole = -   nahore = +                         -y
  9. '                                          Z vzadu = max - 10, normalne ale -1
  10. '    SX1             SX3
  11. tt = .01: t = .1
  12.     Mx = _MOUSEX: My = _MOUSEY
  13.     StredX = Mx
  14.     t = t + tt: IF t > 1 OR t < .1 THEN tt = tt * -1
  15.     R = SIN(t) * -5
  16.     S = COS(t) * -5
  17.     CLS
  18.     _MAPTRIANGLE (SX0, SY0)-(sx3, sy3)-(SX1, SY1), img& TO(DX0, DY0, R)-(DX3, DY3, S)-(DX1, DY1, R), 0, _SMOOTH
  19.     _MAPTRIANGLE (SX0, SY0)-(sx3, sy3)-(sx2, sy2), img& TO(DX0, DY0, R)-(DX3, DY3, S)-(DX2, DY2, S), 0, _SMOOTH
  20.     _DISPLAY
  21.     _LIMIT 30
  22.  
  23.