I am trying to find the slope of a polyline in autocad in a simpler way - autocad

My title pretty much says it all. I am trying to find the slope of a drawn polyline in a faster way than I am currently doing it. Right now I have to draw the line, check the distance in properties, than use the contours I have in the drawing to get my elevation, and than calculate slope off of that. This gets very dicey when dealing with very steep slopes due to the closeness of the contours. Thanks.

I would suggest using the standard AutoCAD DIST command - no programming required. This will return the distance, angle, and delta X, Y, & Z.

Related

Fitting elliptical arcs to points or other curves

I'm struggling to fit an elliptical arc to some points. The points are either from line segments or all part of the same polyline or they are generated from a bezier curve. I basically have two issues:
I would like to fit an elliptical arc to the points if it is reasonable and i straight line if that is a better fit. I'm thinking about starting at the first point and then constructing a line and a ellip_arc to the next points. The one with the lowest error wins. Or something like that at least. The problem is that an ellipse has many free parameters as opposed to a straight line. So how could I fit an ellipse arc to the points? It also has to start and stop at the points.
Fitting seems to be easiest when the ellipse arc is parameterized. Even though I find it hard to define where to start and stop the arc. But, as output, I need to have the ellipse described like in SVG format (Center Point, Minor and Major Axis, rotation to x-axis etc. https://www.w3.org/TR/SVG2/paths.html#PathDataEllipticalArcCommands). I'm not sure how to convert to this representation, or maybe I can fit it like that?
see:
Circular approximation of polygon (or its part)
If you compute this for your curve samples from local change of radius and center you could group and estimate parts of curve that belongs to the same ellipse and also its eccentricity and or a,b semiaxises sizes , center and orientation to ease up your fitting... Even if not get the precise value it will be a start point and range for ellipse parameter fitting hugely improving speed and stability of fitting
Some of the ellipse parameters might be obtained directly if your data has enough large chunks of ellipses see:
Algorithms: Ellipse matching
Fitting SVG like parameters fully will be very slow easier would be to fit just the ellipses first (center,a,b,rotation) and then convert/fit to SVG form elliptic arc. See:
Converting an svg arc to lines
Express SVG arc as series of curves
And finally you can use any fitting algorithm my favorite is this one:
approximation search
I do not code in C# so I have no idea about any existing packages for tasks like this.

How can I simulate a Bezier curve out of an image?

If I have a set of points from a black-white image I scanned.
It looks like a curve and I want to simulate a smooth curve using cubic Bezier curve from those points.
How can I figure out the start point, 2 control points and the end point?
From the image, there are several cubic Bezier curves that can be simulated but I don't know how to figure out the control points.
I have found the solution for my problems and I want to share it.
First, I write a python program to trace the curve and tell me all x,y of the points on the line.
Now, I have one curve.
I then create a line from start to end point and compare the distance between the perpendicular points on those 2 lines. If the distance is not low enough I will move the control point up, down, left, right and find which direction has the least distance. Do this multiple time and I will get a curve that is similar to the curve I have.

How to draw Gaussian Distribution curve

I want to draw a Gaussian Distribution curve, i know
p(x) = (1/σRoot(2π)) x exp (- (x-μ)2/2σ2),
i got the mean and standard deviation, but now i don't know how to proceed, how this bell-graph will be drawn, from where to get the co-ordinates, what's the use of above formula.
I searched a lot on internet and got nothing, every where it's given that how to draw it in excel or in matlab, but nowhere i found how those co-ordinates are got and how those curves are drawn.
if anyone can give me any idea on this it will be of great help.
A graph is simply a set of points plotted on the plane. So basically what you do is pick a set of x-coordinates that you want to plot the curve on. Then plug those x values into your function p(x) to get the y-coordinates.
Lastly, plot the resultant points.
Most graphing software (like your standard graphing calculator) will automate all this functionality for you.

Shape casting a capsule against convex polyhedra

Let's say I have a upright capsule shape (swept sphere) that I would like to cast it along a velocity vector. I would like to be able to find the point of contact and a surface normal for any convex shapes it would intersect along this path. I would also like to find the distance the swept caspule traveled to the point of first contact.
Heres a quick diagram of a capsule being casted against a large convex polyhedra (only one face is drawn)
What kind of algorithm or process could do this? I assume it would be similar to a sphere-cast, but i can't find much on that either.
Since you are considering capsules and convex polyhedra, I suppose you could use something based on GJK. You would get the point of contact and a surface normal during a collision, and the minimum distance between the objects and the associated witness points if there is no collision.
You can also take a look at this publication on Interactive and Continuous Collision Detection for Avatars in Virtual Environments.
Right if its the same as your diagram then finding where it collides is the easy part. Get the circles x and y coordinates and plus '+' the radius of the circle. If that point is at the line of the path then its a collision. The line will have to be found using the line equation here y = mx+c.
The distance can be calculated by setting an intial values of x and y. and then when the object hits set final variables to x and y again. then just the lenght of a line formula to calculate the distance travelled.
The problem is im going on what i know from C++ and i dont know what your programming in.
i think you wanted something else but cant work out what that is from paragraph.

Rotation Question

I have lot of points (which together form a 3d ellipse) in a given frame (X, Y, Z) and then I have vector (u,v,w). What I want is to orient the ellipse along the vector (u,v,w) . Anyone has useful thoughts on how to go about doing that?
Well I assume you can reverse engineer the ellipse equation by seeing what fits into either 4 or 5 points (I can't remember which -- but it should be easy to figure out from the equations.) Once you have that you can know the two major axes, and center point for the ellipse and the transformation should be straight forward.
Although I support #Paul Hsieh's mathematical approach (and have upvoted it), an alternative brute-force approach which will work for many arbitrary elongated shapes is:
Define the origin as the center of your frame
Find the most distant point from the origin.
Determine rotation that will bring that point into line with your vector.
Apply that rotation to all other points.

Resources