# Coding Questions

**URL:** https://discourse.processing.org/c/processing/processing-questions/15.md?page=86

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 87

---

## [Coding Different Trigonometric Functions in Processing](https://discourse.processing.org/t/coding-different-trigonometric-functions-in-processing/22257)

<div class="topic-metadata">

**Author:** [@Adi](https://discourse.processing.org/u/Adi)\
**Replies:** 16\
**Last updated:** [July 6, 2020, 2:45am UTC](https://discourse.processing.org/t/coding-different-trigonometric-functions-in-processing/22257 "2020-07-06T02:45:28Z")

</div>

I am trying to code functions that will put a variable or number through the sigmoid function and another one for the step function.

---

## [Passing shader texture with negative values/accesing 32bit floats shader texture](https://discourse.processing.org/t/passing-shader-texture-with-negative-values-accesing-32bit-floats-shader-texture/22354)

<div class="topic-metadata">

**Author:** [@Beervangeer](https://discourse.processing.org/u/Beervangeer)\
**Replies:** 8\
**Last updated:** [July 5, 2020, 4:02pm UTC](https://discourse.processing.org/t/passing-shader-texture-with-negative-values-accesing-32bit-floats-shader-texture/22354 "2020-07-05T16:02:59Z")

</div>

Hi there, In my processing sketch I am passing textures between two shaders by first drawing into a PGraphics and than passing the PGraphics with the .set function of the shader. This works fine,but the PGraphics clamp…

---

## [Why are my lines moving the same?](https://discourse.processing.org/t/why-are-my-lines-moving-the-same/22392)

<div class="topic-metadata">

**Author:** [@vreakz](https://discourse.processing.org/u/vreakz)\
**Replies:** 5\
**Last updated:** [July 5, 2020, 9:48am UTC](https://discourse.processing.org/t/why-are-my-lines-moving-the-same/22392 "2020-07-05T09:48:18Z")

</div>

Hello, I am trying to figure out why my 2 lines are moving the same. I thought that “for every i” the line move different because of the ‘random’ a. This is my first what own written code. My experience with coding bef…

---

## [How to draw pixel at specific location on the buffer?](https://discourse.processing.org/t/how-to-draw-pixel-at-specific-location-on-the-buffer/21881)

<div class="topic-metadata">

**Author:** [@R1S8K](https://discourse.processing.org/u/R1S8K)\
**Replies:** 18\
**Last updated:** [July 5, 2020, 12:04am UTC](https://discourse.processing.org/t/how-to-draw-pixel-at-specific-location-on-the-buffer/21881 "2020-07-05T00:04:48Z")

</div>

Hi, I want to develop a function that put a pixel on the main image buffer. Because I want to draw a bitmap from 1024 byte array. This what I got so far: PImage pi; void draw\_pixel(int x,int y){ pi = createImage(1…

---

## [I got the java.lang.reflect.InvocationTargetException in my code](https://discourse.processing.org/t/i-got-the-java-lang-reflect-invocationtargetexception-in-my-code/22374)

<div class="topic-metadata">

**Author:** [@yurim](https://discourse.processing.org/u/yurim)\
**Replies:** 1\
**Last updated:** [July 4, 2020, 11:49am UTC](https://discourse.processing.org/t/i-got-the-java-lang-reflect-invocationtargetexception-in-my-code/22374 "2020-07-04T11:49:16Z")

</div>

I’m making calendar program in processing. In the process of adding a schedule for each day, I should make Plan\_Day class array in This\_Day class. But I got java.lang.reflect.InvocationTargetException on and over again.…

---

## [Very simple question - I think](https://discourse.processing.org/t/very-simple-question-i-think/21851)

<div class="topic-metadata">

**Author:** [@alu](https://discourse.processing.org/u/alu)\
**Replies:** 9\
**Last updated:** [July 3, 2020, 3:35pm UTC](https://discourse.processing.org/t/very-simple-question-i-think/21851 "2020-07-03T15:35:19Z")

</div>

Hi ! I’ve been teaching myself Processing with online resources and the Learning Processing book for a couple of months now. It’s so I can execute a project I’m working on. But I can’t seem to find a way to do this seem…

---

## [Batch Edit: Load Multiple images from data folder](https://discourse.processing.org/t/batch-edit-load-multiple-images-from-data-folder/22344)

<div class="topic-metadata">

**Author:** [@CKMJPEG](https://discourse.processing.org/u/CKMJPEG)\
**Replies:** 7\
**Last updated:** [July 3, 2020, 3:31am UTC](https://discourse.processing.org/t/batch-edit-load-multiple-images-from-data-folder/22344 "2020-07-03T03:31:24Z")

</div>

Hi Processing Community! In most examples I have seen that work with loadImage, you usually work with single images, but what If you want to process at least 100 images with the same script? How would you load images f…

---

## [Move Pixels Based on Brightness](https://discourse.processing.org/t/move-pixels-based-on-brightness/22343)

<div class="topic-metadata">

**Author:** [@CKMJPEG](https://discourse.processing.org/u/CKMJPEG)\
**Replies:** 1\
**Last updated:** [July 2, 2020, 11:36pm UTC](https://discourse.processing.org/t/move-pixels-based-on-brightness/22343 "2020-07-02T23:36:53Z")

</div>

Hi Processing community. I am new to processing, but have used many scripts and am somewhat familiar with the interface and in thinking through the code. My question is I would like to move the pixels of an image based…

---

## [Detecting mouse clicks that are outside the canvas?](https://discourse.processing.org/t/detecting-mouse-clicks-that-are-outside-the-canvas/22335)

<div class="topic-metadata">

**Author:** [@qewer3322](https://discourse.processing.org/u/qewer3322)\
**Replies:** 4\
**Last updated:** [July 2, 2020, 9:37pm UTC](https://discourse.processing.org/t/detecting-mouse-clicks-that-are-outside-the-canvas/22335 "2020-07-02T21:37:14Z")

</div>

I have researched all that I could for this, there is not many stuff to see. I read somewhere that this is not possible but I feel like it is. Does anyone know? Like when I do void mousePressed() { } that only works w…

---

## [Processing in Swing](https://discourse.processing.org/t/processing-in-swing/22120)

<div class="topic-metadata">

**Author:** [@creepercrack](https://discourse.processing.org/u/creepercrack)\
**Replies:** 3\
**Last updated:** [July 2, 2020, 9:26pm UTC](https://discourse.processing.org/t/processing-in-swing/22120 "2020-07-02T21:26:30Z")

</div>

Is there any way to get Processing to render into a JFrame (or something along those lines)? I’ve been reading and trying for myself but coudn’t get it to work The idea is to be able to make a UI using swing on top of …

---

## [Render a lot of same images](https://discourse.processing.org/t/render-a-lot-of-same-images/22289)

<div class="topic-metadata">

**Author:** [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Replies:** 7\
**Last updated:** [July 2, 2020, 3:43pm UTC](https://discourse.processing.org/t/render-a-lot-of-same-images/22289 "2020-07-02T15:43:44Z")

</div>

Is there a way to render a lot of same images fast?i made a array with 2 PImage objects…and rendering 2304 of them on the screen…with this i have 23-24 FPS on average…how can i(if possible) make this faster?thanks)

---

## [Text in loop to in several rows](https://discourse.processing.org/t/text-in-loop-to-in-several-rows/22323)

<div class="topic-metadata">

**Author:** [@Maxnotabletoprogramm](https://discourse.processing.org/u/Maxnotabletoprogramm)\
**Replies:** 3\
**Last updated:** [July 2, 2020, 2:00pm UTC](https://discourse.processing.org/t/text-in-loop-to-in-several-rows/22323 "2020-07-02T14:00:52Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hey, I want to make a loop that counts the Numbers up to 1500 and draws them. The size is (700, 700) so I have to make rows of numbers. Just so…

---

## [Processing saving empty PDF](https://discourse.processing.org/t/processing-saving-empty-pdf/22315)

<div class="topic-metadata">

**Author:** [@TimoL](https://discourse.processing.org/u/TimoL)\
**Replies:** 4\
**Last updated:** [July 2, 2020, 9:22am UTC](https://discourse.processing.org/t/processing-saving-empty-pdf/22315 "2020-07-02T09:22:16Z")

</div>

I’ve run into this problem where my pdf is coming out blank even though there is stuff on the screen. I think it has to do with how I’m drawing to the canvas using mousePressed. any ideas? import processing.pdf.\*; boo…

---

## [Arrange array in ascending order](https://discourse.processing.org/t/arrange-array-in-ascending-order/22314)

<div class="topic-metadata">

**Author:** [@alex](https://discourse.processing.org/u/alex)\
**Replies:** 3\
**Last updated:** [July 2, 2020, 6:19am UTC](https://discourse.processing.org/t/arrange-array-in-ascending-order/22314 "2020-07-02T06:19:05Z")

</div>

Hi, How do i arrange an array of number for e.g. int \[\] array = {3,2,7,4,9,1}; into ascending order without using the sort() function? Thanks

---

## [How to find min X and Y of pixel](https://discourse.processing.org/t/how-to-find-min-x-and-y-of-pixel/22222)

<div class="topic-metadata">

**Author:** [@Morzin](https://discourse.processing.org/u/Morzin)\
**Replies:** 6\
**Last updated:** [July 1, 2020, 5:45pm UTC](https://discourse.processing.org/t/how-to-find-min-x-and-y-of-pixel/22222 "2020-07-01T17:45:55Z")

</div>

Hello, I want to make a program that finds the object in the picture. I decided that it would be easiest to recognize it by color, because the background under the object could have any other color. So far I managed t…

---

## [Making a Game "Launcher"](https://discourse.processing.org/t/making-a-game-launcher/22281)

<div class="topic-metadata">

**Author:** [@qewer3322](https://discourse.processing.org/u/qewer3322)\
**Replies:** 3\
**Last updated:** [July 1, 2020, 12:17pm UTC](https://discourse.processing.org/t/making-a-game-launcher/22281 "2020-07-01T12:17:17Z")

</div>

Is there any way to make something like a “launcher” in processing. What I mean by that is basically a main menu and when you click a button, it closes itself and opens another .exe file (or runs a processing source code…

---

## [Is there a better way to draw gradient colored ellipse?](https://discourse.processing.org/t/is-there-a-better-way-to-draw-gradient-colored-ellipse/22220)

<div class="topic-metadata">

**Author:** [@nh3](https://discourse.processing.org/u/nh3)\
**Replies:** 3\
**Last updated:** [June 29, 2020, 3:07pm UTC](https://discourse.processing.org/t/is-there-a-better-way-to-draw-gradient-colored-ellipse/22220 "2020-06-29T15:07:37Z")

</div>

I’m pretty new to Processing and graphical programming but keen to learn new stuff. I was trying to create a gradient colored sun for my project but I couldn’t find any obvious technique to do this. This is the solution …

---

## [How to make and process a new image(distinct from the screen)?](https://discourse.processing.org/t/how-to-make-and-process-a-new-image-distinct-from-the-screen/22284)

<div class="topic-metadata">

**Author:** [@SilverPrevail](https://discourse.processing.org/u/SilverPrevail)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 1:48am UTC](https://discourse.processing.org/t/how-to-make-and-process-a-new-image-distinct-from-the-screen/22284 "2020-07-01T01:48:47Z")

</div>

I want to process a image with the functions like text() or rect(),circle() and put a part of the image in the screen with image.get(); To explain a little more, I have a long text which I want to visualize at the scree…

---

## [Problem with OOP implementation of interface class](https://discourse.processing.org/t/problem-with-oop-implementation-of-interface-class/22255)

<div class="topic-metadata">

**Author:** [@Richard](https://discourse.processing.org/u/Richard)\
**Replies:** 4\
**Last updated:** [June 30, 2020, 4:48pm UTC](https://discourse.processing.org/t/problem-with-oop-implementation-of-interface-class/22255 "2020-06-30T16:48:20Z")

</div>

Hello everybody. I am struggling with an OOP architecture problem i have for a game i am coding. Sorry in advance for my poor English. The aim of the game is to shoot monsters with a canon. The objects of my game are …

---

## [Transform path to follow an arc](https://discourse.processing.org/t/transform-path-to-follow-an-arc/22166)

<div class="topic-metadata">

**Author:** [@rebeccajkaye](https://discourse.processing.org/u/rebeccajkaye)\
**Replies:** 6\
**Last updated:** [June 30, 2020, 11:06am UTC](https://discourse.processing.org/t/transform-path-to-follow-an-arc/22166 "2020-06-30T11:06:14Z")

</div>

Hello I’m hoping for some help - I’d also really appreciate any guidance as to if this is the best way of thinking. In my example, I have a line in the shape of a sine wave (although I’d like to apply this thinking to …

---

## [Loading different scenes after time delay](https://discourse.processing.org/t/loading-different-scenes-after-time-delay/22275)

<div class="topic-metadata">

**Author:** [@Dominantxx](https://discourse.processing.org/u/Dominantxx)\
**Replies:** 1\
**Last updated:** [June 30, 2020, 10:37am UTC](https://discourse.processing.org/t/loading-different-scenes-after-time-delay/22275 "2020-06-30T10:37:36Z")

</div>

please format code with \</\> button \* homework policy \* asking questions So when the code begins to run (play), I want an image to fill the screen. After a time delay, let’s say 5 seconds, I want to load a different s…

---

## [Need help/hint on mouse position with rotated objects](https://discourse.processing.org/t/need-help-hint-on-mouse-position-with-rotated-objects/22243)

<div class="topic-metadata">

**Author:** [@Cillo](https://discourse.processing.org/u/Cillo)\
**Replies:** 0\
**Last updated:** [June 29, 2020, 10:36am UTC](https://discourse.processing.org/t/need-help-hint-on-mouse-position-with-rotated-objects/22243 "2020-06-29T10:36:57Z")

</div>

Hello, I’m trying to make a visualization of tracks in my spotify playlists. The goal I’m trying to reach is doing a sort of radial column chart with the 100 songs of my playlists, with lengths based on track duration. I…

---

## [Return object in method and use its functions](https://discourse.processing.org/t/return-object-in-method-and-use-its-functions/22140)

<div class="topic-metadata">

**Author:** [@Alphaprot](https://discourse.processing.org/u/Alphaprot)\
**Replies:** 6\
**Last updated:** [June 28, 2020, 8:28pm UTC](https://discourse.processing.org/t/return-object-in-method-and-use-its-functions/22140 "2020-06-28T20:28:56Z")

</div>

Hey folks, I am trying to get interactions done in a little fisicia-based game of mine. Goal is a method/function, that returns the nearest type of objectType X (passed as an argument) in a given interaction distance (s…

---

## [Detection and evaluate geometric shapes](https://discourse.processing.org/t/detection-and-evaluate-geometric-shapes/22163)

<div class="topic-metadata">

**Author:** [@Ezzat\_Oraby](https://discourse.processing.org/u/Ezzat_Oraby)\
**Replies:** 13\
**Last updated:** [June 28, 2020, 5:27pm UTC](https://discourse.processing.org/t/detection-and-evaluate-geometric-shapes/22163 "2020-06-28T17:27:05Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Dear friends I uploaded an image for which I would estimate some dimensions, there are central circles and associated circles around to measure …

---

## [Estimation of Energy difference of Images for greased concrete surface with time](https://discourse.processing.org/t/estimation-of-energy-difference-of-images-for-greased-concrete-surface-with-time/22179)

<div class="topic-metadata">

**Author:** [@Ezzat\_Oraby](https://discourse.processing.org/u/Ezzat_Oraby)\
**Replies:** 1\
**Last updated:** [June 27, 2020, 10:14pm UTC](https://discourse.processing.org/t/estimation-of-energy-difference-of-images-for-greased-concrete-surface-with-time/22179 "2020-06-27T22:14:14Z")

</div>

Regarding to the attached image, we have a study on greased cement cubes absorption of grease. The intensity (I) of each cube has been calculated and then the Energy (E), E = I^2 the differences between the image energ…

---

## [Where do I put this rectangle in this code?](https://discourse.processing.org/t/where-do-i-put-this-rectangle-in-this-code/22155)

<div class="topic-metadata">

**Author:** [@qewer3322](https://discourse.processing.org/u/qewer3322)\
**Replies:** 14\
**Last updated:** [June 27, 2020, 6:21pm UTC](https://discourse.processing.org/t/where-do-i-put-this-rectangle-in-this-code/22155 "2020-06-27T18:21:48Z")

</div>

I’m trying to make a main menu and have this atm float x = 260; float y = 480; float w = 240; float h = 60; float q = 160; float a = 335; float s = 280; float d = 60; PFont zigBlack; boolean screen2 = false; void setu…

---

## [Specific position of squares](https://discourse.processing.org/t/specific-position-of-squares/21669)

<div class="topic-metadata">

**Author:** [@aylen2000](https://discourse.processing.org/u/aylen2000)\
**Replies:** 1\
**Last updated:** [June 8, 2020, 3:26am UTC](https://discourse.processing.org/t/specific-position-of-squares/21669 "2020-06-08T03:26:37Z")

</div>

Hi, I need help with a college job. It consists of generating with the movement and speed of the mouse, different abstract works of art, in my case select some that contain different squares each one in a specific positi…

---

## [Problem with inserting an image array](https://discourse.processing.org/t/problem-with-inserting-an-image-array/22164)

<div class="topic-metadata">

**Author:** [@marika20](https://discourse.processing.org/u/marika20)\
**Replies:** 3\
**Last updated:** [June 26, 2020, 8:50am UTC](https://discourse.processing.org/t/problem-with-inserting-an-image-array/22164 "2020-06-26T08:50:40Z")

</div>

Hi everyone, one question: if I have an array of images, for example PImage \[\] dogs = new PImage \[4\] then inserting each image: dogsOne = loadImage (""); then when I have to insert my images in image (… 0,0,100,100)…

---

## [(drawbot image to gcode v2) error when running](https://discourse.processing.org/t/drawbot-image-to-gcode-v2-error-when-running/18273)

<div class="topic-metadata">

**Author:** [@motorimicro](https://discourse.processing.org/u/motorimicro)\
**Replies:** 8\
**Last updated:** [June 25, 2020, 5:50pm UTC](https://discourse.processing.org/t/drawbot-image-to-gcode-v2-error-when-running/18273 "2020-06-25T17:50:56Z")

</div>

Hi everyone I am trying to run this sketch, theoretically it should work as written and tested by many other users but in my case it gives me this error. do you know how to fix the situation? the file can be downloaded…

---

## [How to get coordinates of where two shapes touch](https://discourse.processing.org/t/how-to-get-coordinates-of-where-two-shapes-touch/22136)

<div class="topic-metadata">

**Author:** [@aaronjmcd2](https://discourse.processing.org/u/aaronjmcd2)\
**Replies:** 3\
**Last updated:** [June 25, 2020, 2:55am UTC](https://discourse.processing.org/t/how-to-get-coordinates-of-where-two-shapes-touch/22136 "2020-06-25T02:55:30Z")

</div>

Hi! I’m trying to figure out if there’s a way to get the x and y coordinates of where two separate shapes (any shapes) touch. Any idea how I might obtain that information? Thanks!

[Previous page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=85)

[Next page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=87)
