Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
I have a 3D mesh I'm calculating vertex normals for, from the mesh's face normals. Each vertex normal is computed as an average of all the normals of the faces that share that vertex.
All that works fine, except in cases where -- due to uneven subdivision of faces over the surface of the mesh -- vertex normals can be skewed. Here is an example of an object with a skewed vertex normal, in one of its corners:
In this image you can see the various face normals (blue), the ideal vertex normals (yellow), and the problematic vertex normal (red) which is being skewed by the many face normals on the heavily subdivided side of the mesh which all share the vertex.
So my question is: is it possible to calculate a vector median, instead of an average? Here's an extra image to further illustrate:
The idea is to weight the face normals by the angle of the edges that connect to the vertex in question, before adding them to that vertex's normal.
So in my first image, the large grouping of normals on the right would have the same cumulative weight as the single normal on the top/left....resulting in an overall ideal normal for that corner vertex.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am looking for a library or other source code that will help me display non-intersecting spheres or spheroids, not necessarily a bin packing issue, but it could be. Each of these spheres can also contain a further set of much smaller spheres within. I would then like to take a slice, i.e. two parallel planes a distance apart or a cuboid, through this "world", and calculate how many larger as well as smaller spheres are "captured" by the given slice, and to generate a 3D graphic.
Although I have plenty of experience in programming, etc. 3D spaces are new to me, and my geometry a bit rusty. I've looked into the rgl package for R+ as well as D3.js, but don't see an obvious solution. I've searched through StackOverflow and there is the "Cube sphere intersection test?" post, but it doesn't quite get me what I'm looking for. Not sure if this falls under a "collision" problem or more of a stereology problem perhaps, but the CRAN package StereoMorph also didn't yield any answers.
Any suggestions as to where I should look are welcome. I'm also not wed to any particular computer language.
Thanks!
A sphere is defined as:
[centerX,centerY,centerZ,radius]
and a plane is defined as
[normalVectorX,normalVectorY,normalVectorZ,distance]
Distance is the distance from the origin to the plane if you were to travel along the direction of the normal vector. In other words, if you multiply each component of the normal vector by distance you will have a point somewhere on the plane.
To test if a sphere is on one side of the plane or the other:
Project the sphere center onto the plane normal, add the radius of the sphere, and if that sum is less than the plane distance, then it has not intersected.
CENTER = [centerX,centerY,centerZ]
NORMAL = [normalVectorX,normalVectorY,normalVectorZ]
isBelowHighPlane = dotProduct(CENTER,NORMAL)+radius < distance
For the other plane, lets say the "lower" plane, subtract the radius and test if the sum is greater:
isAboveLowPlane = dotProduct(CENTER,NORMAL)-radius > distance
Therefore, if both the above tests are true the sphere is contained.
NOTE: If your plane is defined some other way, for example by three points in space A,B,C, you can find the normal by taking the cross product of any two sides:
normalVector = normalize(crossProduct((B-A),(B-C)))
And once you have that normal vector, you can find the distance by projecting the vector from the origin to any of those points onto the normal:
distance = dotProduct(B,normalVector)
Note, distance may be negative.
So the 3d functions you need in whatever language you choose are:
dotProduct(), crossProduct(), and normalize()
If you have some connection from small spheres to their containing big sphere, and that big sphere is either completely in or completely out, then you can instantly know the state of all the small spheres. However, to test if a big sphere is completely out, you'll need extra variations on the test:
isAboveHighPlane = dotProduct(CENTER,NORMAL)-radius > distance
isBelowLowPlane = dotProduct(CENTER,NORMAL)+radius < distance
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Given a graph of a formula, how can I find its formula?
Do I need some OCR or something like that?
In general you need:
detect the graph position (bounding box) in image
you are usually looking for rectangle outlined (usually in black) area
extract/input graph scales
either input them by user or read via OCR (as you suggested). The scale values and units are usually along the x,y axises of the graph bounding box. You need to find at least 2 separate points per axis to form transformation from pixels to units. In case of non linear scales you need to have more points to detect log,etc scales ...
extract graph points
the graph curve is usually in different color or stroke width so it should be relatively easy to extract all points. Form a list of points (in case of function sorted by x).
apply curve fitting on the points from #3
there are many approaches ... can use piecewise interpolation, piecewise approximation BEZIER/SPLINE, interpolation polynomials (Lagrange...) or FFT/DCT (sin waves). For non complicated shapes approximation search minimizing distance between points and computed polynomial will be enough. This step mainly depends on what precision, output function form, runtime you need.
Hard to be more specific as you did not provide any details what so ever.
Finding the mathematical algorithm to which matches an input and output together might help a bit.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I would realize the papercraft of a geodesic sphere like THIS .
Is the dual of the one discussed in THIS OTHER QUESTION .
Where can I find the printable nets, or the online resources to create them?
In the other discussion I learned that there are 3 classes of possible tessellations.
One of these classes needs less pentagons to tessellate the sphere?
I don't exactly know how much faces I need, indicatively between 100 and 200.
Which chord factors I should consider?
Thanks to all
genna,
The link that I provided in the former discussion...
http://thomson.phy.syr.edu/thomsonapplet.php
...provides for display of a dual. Unfortunately, the java applet will only export a data set for the geodesic triangular tessellation; not the dual.
The dual can be constructed from the triangular tessellation, by importing the vertex (point) data set (from the java applet) into a 3D-graphics program, and then following the rules of the definition of a dual. (Each pent/hex face will use the triangular vertex point as the centerpoint of a circle, being equidistant from the sphere center and normal to the central vector. The intersections of these circles will produce the linear edges of the dual faces.)
All tessellated duals, based on the icosahedron, will have the same number of pentagonal faces (12), regardless of how many hex faces are produced.
-Taff
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a sequence of points ( not vertices's ) which makes a open shape but they are randomly arranged in a array, but to effectively recognize the shape what I need to do is to arrange the points in order the shape was made.
Is there any way in which I can recognize which is the start and end point?
Edit: The points are in a 2D plane and I have the boundingbox. The points are obtained from a image processing algorithm which gives me the points from top to bottom (not in the order shape was made) as the image is processed pixel by pixel.
Given a set of points, there are various ways to reconstruct a shape from them. If you only take the distance between two points into account, then this basically boils down to a classical traveling salesman problem: you're looking for a tour through all points which minimizes the length of said tour. You could add one mor atrificial point which has the same distance to all points in the plane. That would turn a cyclic tour into a linear one: the point after that artificial point would be the starting point, and the point just before it would be the end point. There might be TSP approximation algorithms out there which can do non-cyclic tours out of the box.
Only considering distance ignores any inertia inherent to the motion of the painting device. So I don't claim that this is the best possible model. But for most models, I would still think about a way to determine the order all the points, which automatically results in identifying the start and end point. I can't think of a way to reliably identify these two without a way to order all points in between as well.
EDIT: Seems like you want to implement image segmentation instead:
Paper
Scroll down to page 28 for the mathematical description. This will give you the contours. Does that get you to where you want to be?
What you are trying to do is implement
OCR
without the use of an external library. I wouldn't recommend it for production purposes, but think it would be a great problem to tackle.
My suggestion would be to build a simple Artificial Neural Network with the image surface providing the input signals. A feed-forward, backpropagation ANN is quite easy to code, but extremely tricky to get the results you want.
You are, after all, tackling a problem that has no perfect solution yet despite many attempts. I wish you the best of luck and please keep us updated with your progress!
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Imagine that we have a regular plane defined in three-dimensional Euclidean space ("world space").
On this plane, we trace an arc from point A to point B, like a bullet trajectory, in the plane's space ("local space"). That is to say, if the plane was transformed in "world space" using for example rotation, the arc would still remain relative to the plane as it is defined in the plane's space.
We now apply an arbitrary deformation to the plane. It follows that the arc would likewise be deformed in world space.
Which branch of geometry (or mathematics in general) would be used to approach calculating the path of this arc in world space; and for problems like these in general; and how would this problem be approached in software?
Update:
This falls within the domain of Differential geometry.
I believe you are looking for affine transformations, though if your arbitrary deformations to the plane are "strong enough" you might be working with Projective geometry instead.