Skip to main content

All Questions

Tagged with
2 votes
1 answer
137 views

When to overload an operator in C++ as a member of a user-defined data structure and when not? I am completely lost

For any of you who can help explain to me when and when not to overload an operator as a member of a class or struct for example or not as a member, like global one. The thing is that I am learning ...
pk6x's user avatar
  • 23
1 vote
2 answers
51 views

I want to plot the route of a vector in a Lindenmayer system. How do I apply function to vector and get positions to plot?

This is my first question on stack overflow. I'm working on a script to plot a Lindenmayer-system. I already figured out how to do it by using the turtle package, but I would like to do it using ...
jaquesnado's user avatar
-1 votes
1 answer
164 views

Convert arbitrary grid of subpixel points to raster image

I hope you are doing well. I am stuck at one part of a visual effect program in C++, and wanted to ask for help. I have an array of colors at random positions on an image. There can be any number of ...
jonahclarsen's user avatar
0 votes
0 answers
85 views

Distance from point to conic bezier

I'm trying to rasterize a conic (rational quadratic) bezier, and came across this snippet: https://www.shadertoy.com/view/MlKcDD The idea is to calculate the distance from each fragment to the bezier ...
Illari's user avatar
  • 43
0 votes
0 answers
457 views

3d rotations defined by angles between original and new coordinate axes

This type of question has been asked before, but I haven't been able to find a satisfactory explanation. Perhaps I'm just a bit slow... Say that I have a global right-handed coordinate system ...
Tommy Blankinship's user avatar
1 vote
1 answer
832 views

How to Make Moving Sprite Point Toward Mouse in P5?

I was trying to make a program that pointed a sprite toward my mouse despite its displacement from the origin. It rotates fine when it is at the origin, but obviously, when I start to move the sprite ...
Corey Predella's user avatar
0 votes
1 answer
100 views

Trim start and end points of straight line to where they enter/exit a rectangle?

I'm doing some canvas painting, and for performance reasons I want to get the coordinate of where a straight line enters and/or exits the screen. To put it more simply, I want to find out the ...
Magnus's user avatar
  • 18.2k
0 votes
1 answer
727 views

How to find 3D points coordinates in a perpendicular plane to a given vector

I have two points in a 3d space, one point is (x,0,z) and the other one is the origin (0,0,0), through those points there is a passing line with length L that is starting from the first point and ...
Roni's user avatar
  • 23
1 vote
2 answers
239 views

Algorithm to find the inner side of a polygon [closed]

Within my CAD-like application I have different kinds of 2D polygons. They can be concave or convex, and they can be drawn clockwise or counter-clockwise. Now I want to find out where the inner side ...
Elmi's user avatar
  • 6,135
0 votes
1 answer
704 views

Vector on upper half of hemisphere

I have a normal vector N, which defines the upper half of an hemisphere and an function, which creates random points P on the hemisphere. Now I want to know, if the randomly choosen point is on the ...
Philipp's user avatar
  • 15.6k
3 votes
1 answer
1k views

Find center of circle defined by 2 points and their tangent intersection

I have Cartesian coordinates P, P0 and P1, how do I find C? Note that C is also the orthocenter of the triangle which has P as a vertex and P0 and P1 as altitudes. This code will run a couple ...
Simon Meskens's user avatar
-1 votes
2 answers
1k views

Vector Math with System.Numerics

I have the following code which rotates vectors and always keeps the result in the positive x,y,z plane. I want to re-factor the code to use the System.Numerics type Vector3 and Matrix4x4. Could ...
muscleman71's user avatar
8 votes
2 answers
4k views

Line offset (parallel lines) without cusps

I'm trying to draw lines with offset to main line like on attachment. I have problems with my code. It generating intersections and cusps on the lines. (attachment) Maybe someone can help me with ...
seek's user avatar
  • 1,095
6 votes
2 answers
11k views

How can I compute normal on the surface of a cylinder?

I am working on a ray tracer and I got around to adding cylinders to the scene. The point I am stuck at is finding the surface normal vector in the point the ray hits. I need this to be able to do the ...
Rpreda's user avatar
  • 157
0 votes
1 answer
111 views

Gets points from Vector3D and two lines from this point

I would like to get points between two lines, defined by a Vec3D point for origin, and angle from direction line. Since my english and my Maths are not good enough to explain, i drawn a picture : In ...
Bastiflew's user avatar
  • 1,156

15 30 50 per page