graphics

How to hide invisible elements of the 3d drawing?

浪子不回头ぞ 提交于 2021-01-24 09:51:13
问题 I'm trying to draw a 3d image that displays a ripple: function myFunc(x, y) { let zRipple = Math.pow(2, -0.005 * (Math.abs(x) + Math.abs(y))) * Math.cos(((x * x + y * y) * 2 * pi) / 180 / width) * height; return zRipple; } width and height here are constants that define a drawing area and are equal to 200 in my tests. My approach is based on what I recall from an article that I read 30 years ago and trying to recall now. The idea is to: split the whole drawing board into the 10-pixel grid for

Rotating body from spherical coordinates

烈酒焚心 提交于 2021-01-21 09:18:19
问题 Is it possible to rotate body which has its vertices defined in spherical coordinates. Currently I am doing collage project in VHDL and is about rotating dodecahedron and presenting over VGA. I applied pinhole camera model equations and that required just two sin/cos calculation and two multiplication per vertice. I was just thinking about rotating around 3rd axis using 3 steps over two angles but i am unable to figure out proper equations and even if this is possible. Edit I think I got it.

Python. How to get the x,y coordinates of a offset spline from a x,y list of points and offset distance

北城余情 提交于 2021-01-20 20:10:05
问题 I need to make an offset parallel enclosure of an airfoil profile curve, but I cant figure out how to make all the points be equidistant to the points on the primary profile curve at desired distance. this is my example airfoil profile this is my best and not good approach EDIT @Patrick Solution for distance 0.2 回答1: You'll have to special-case slopes of infinity/zero, but the basic approach is to use interpolation to calculate the slope at a point, and then find the perpendicular slope, and

Python. How to get the x,y coordinates of a offset spline from a x,y list of points and offset distance

穿精又带淫゛_ 提交于 2021-01-20 20:07:26
问题 I need to make an offset parallel enclosure of an airfoil profile curve, but I cant figure out how to make all the points be equidistant to the points on the primary profile curve at desired distance. this is my example airfoil profile this is my best and not good approach EDIT @Patrick Solution for distance 0.2 回答1: You'll have to special-case slopes of infinity/zero, but the basic approach is to use interpolation to calculate the slope at a point, and then find the perpendicular slope, and

How to repeatedly change colors of a circle using a timer in a Java GUI?

给你一囗甜甜゛ 提交于 2021-01-20 09:19:14
问题 I am trying to create a traffic light using a Java GUI, where it displays only one circle and it changes colours from red, to yellow, to green. There should be a timer and only yellow should be changing to green within 3 seconds. I have set up a circle and a colour red, but I am unable to change it to the colours yellow, and green respectively using a timer. Btw I am really new to GUI and could not find helpful sources online, although I still watched a couple of youtube videos but did not

Update during resize in Pygame

▼魔方 西西 提交于 2021-01-18 04:13:38
问题 I'm developing a grid based game in pygame, and want the window to be resizable. I accomplish this with the following init code: pygame.display.set_mode((740, 440), pygame.RESIZABLE) As well as the following in my event handler: elif event.type == pygame.VIDEORESIZE: game.screen = pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE) # Code to re-size other important surfaces The problem I'm having is that it seems a pygame.VIDEORESIZE event is only pushed once the user is done

Nearest Neighbour to Bilinear Interpolation

≡放荡痞女 提交于 2021-01-08 02:10:45
问题 I'm currently working on a project which requires me to read images and enlarge them. I'm currently using the nearest neighbour algorithm to enlarge my image, but i'm trying to use bilinear interpolation and finding it hard to implement. Here is my current NN algorithm: public void doThumbnailResize() { resizedImage = new BufferedImage(55, 55, BufferedImage.TYPE_3BYTE_BGR); int h = resizedImage.getHeight(), h2 = image1.getHeight(); int w = resizedImage.getWidth(), w2 = image1.getWidth(); for

How do I solve the following error in Linux Graphics C program?

这一生的挚爱 提交于 2021-01-05 11:06:11
问题 I am trying to compile the following code,but it gives me a error message as listed below. I am a beginner in linux c graphics and cannot figure it out. Can anyone suggest a solution? code: #include<stdio.h> #include<graphics.h> void main() { int gd = DETECT, gm; int dx, dy, p, end; float x1, x2, y1, y2, x, y; initgraph(&gd, &gm,NULL); printf("Enter Value of X1: "); scanf("%f", &x1); printf("Enter Value of Y1: "); scanf("%f", &y1); printf("Enter Value of X2: "); scanf("%f", &x2); printf(

Using fences to clean-up command buffers and synchronizing swap chain images at the same time

爷,独闯天下 提交于 2021-01-05 07:26:42
问题 Say I have a swap chain consisting of n images and I allow k "frames in flight". I ensure correct synchronization between vkAcquireNextImageKHR , vkQueueSubmit and vkQueuePresentKHR by a set of semaphores imageAvailableSemaphore and renderFinishedSemaphore and a fence imageInFlight like it is done in this tutorial: imageAvailableSemaphores.resize(MAX_FRAMES_IN_FLIGHT); renderFinishedSemaphores.resize(MAX_FRAMES_IN_FLIGHT); inFlightFences.resize(MAX_FRAMES_IN_FLIGHT); The fences are needed to

Using fences to clean-up command buffers and synchronizing swap chain images at the same time

旧城冷巷雨未停 提交于 2021-01-05 07:26:39
问题 Say I have a swap chain consisting of n images and I allow k "frames in flight". I ensure correct synchronization between vkAcquireNextImageKHR , vkQueueSubmit and vkQueuePresentKHR by a set of semaphores imageAvailableSemaphore and renderFinishedSemaphore and a fence imageInFlight like it is done in this tutorial: imageAvailableSemaphores.resize(MAX_FRAMES_IN_FLIGHT); renderFinishedSemaphores.resize(MAX_FRAMES_IN_FLIGHT); inFlightFences.resize(MAX_FRAMES_IN_FLIGHT); The fences are needed to