03-01-2024, 08:13 PM
(This post was last modified: 03-02-2024, 07:28 PM by stevantosic.)
Maintain aspect ratio:
LDNetwork.SetSSL()
flickr = LDUtilities.FixFlickr()
imageURL = Flickr.GetRandomPicture("word")
tmpFile = File.GetTemporaryFilePath()
LDNetwork.DownloadFile(tmpFile,imageURL)
image = ImageList.LoadImage(tmpFile)
File.DeleteFile(tmpFile)
view3D = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
LD3DView.AutoControl("True","True",2,1)
LD3DView.AddAmbientLight(view3D,"White")
a = ImageList.GetWidthOfImage(image)
b = ImageList.GetHeightOfImage(image)
k = LDMath.FixDecimal(a/b, 2)
TextWindow.WriteLine(k)
pointsR = "-x -0.5 0.5:x -0.5 0.5:x 0.5 0.5"
pointsL = "x 0.5 0.5:-x 0.5 0.5:-x -0.5 0.5"
pointsR = LDText.Replace(pointsR, "x", 0.5 * k)
TextWindow.WriteLine(pointsR)
pointsL = LDText.Replace(pointsL, "x", 0.5 * k)
TextWindow.WriteLine(pointsL)
triangleR = LD3DView.AddGeometry(view3D, pointsR,"0 1 2","" , "Red","D")
'LD3DView.AddImage(view3D,triangleR, "0 0:1 0:1 1",image,"D") '
LD3DView.AddImage(view3D,triangleR, "0 1:1 1:1 0",image,"D") ' Y: 0 <-> 1 or Y = 1 - Y
triangleL = LD3DView.AddGeometry(view3D,pointsL,"0 1 2","" , "Red","D")
'LD3DView.AddImage(view3D,triangleL, "1 1:0 1:0 0",image,"D") '
LD3DView.AddImage(view3D,triangleL, "1 0:0 0:0 1",image,"D") ' Y: 0 <-> 1 or Y = 1 - Y
LD3DView.TranslateGeometry(view3D,triangleR,0,0,8)
LD3DView.TranslateGeometry(view3D,triangleL,0,0,8)
LDNetwork.SetSSL()
flickr = LDUtilities.FixFlickr()
imageURL = Flickr.GetRandomPicture("word")
tmpFile = File.GetTemporaryFilePath()
LDNetwork.DownloadFile(tmpFile,imageURL)
image = ImageList.LoadImage(tmpFile)
File.DeleteFile(tmpFile)
view3D = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
LD3DView.AutoControl("True","True",2,1)
LD3DView.AddAmbientLight(view3D,"White")
a = ImageList.GetWidthOfImage(image)
b = ImageList.GetHeightOfImage(image)
k = LDMath.FixDecimal(a/b, 2)
TextWindow.WriteLine(k)
pointsR = "-x -0.5 0.5:x -0.5 0.5:x 0.5 0.5"
pointsL = "x 0.5 0.5:-x 0.5 0.5:-x -0.5 0.5"
pointsR = LDText.Replace(pointsR, "x", 0.5 * k)
TextWindow.WriteLine(pointsR)
pointsL = LDText.Replace(pointsL, "x", 0.5 * k)
TextWindow.WriteLine(pointsL)
triangleR = LD3DView.AddGeometry(view3D, pointsR,"0 1 2","" , "Red","D")
'LD3DView.AddImage(view3D,triangleR, "0 0:1 0:1 1",image,"D") '
LD3DView.AddImage(view3D,triangleR, "0 1:1 1:1 0",image,"D") ' Y: 0 <-> 1 or Y = 1 - Y
triangleL = LD3DView.AddGeometry(view3D,pointsL,"0 1 2","" , "Red","D")
'LD3DView.AddImage(view3D,triangleL, "1 1:0 1:0 0",image,"D") '
LD3DView.AddImage(view3D,triangleL, "1 0:0 0:0 1",image,"D") ' Y: 0 <-> 1 or Y = 1 - Y
LD3DView.TranslateGeometry(view3D,triangleR,0,0,8)
LD3DView.TranslateGeometry(view3D,triangleL,0,0,8)