Can anyone help me?
I want to create a script to run in AutoCAD, that automatically makes OFFSET=100 of all LWPOLYLINE / AREA and delete the original and of this new offset reduce the vertices of all.
Tanks,
Select objects:
LWPOLYLINE Layer: ""
Space: Model space
Handle = 412
Closed
Constant width 0.0000
area: please use AREA command for huge polylines
perimeter 47713.9844
Related
I am working in Arcgis 10.3.1 and I am trying to add some random points into a polygon shapefile as the center for circular sampling plots, however, every time I use the minimum allowed distance (I use 15 m because the plot radius will be 10 m) I get an error.
Without using the minimum allowed distance it works fine but usually the samples spacing is not right.
I was thinking maybe there was not space in the area to have such spacing but the area i 4000 m2 and a 10m radius circular plot is only around 300m2 (I need only 4). Even if I use 2m distance I get the error.
I am not sure if I am using it right. Is there any other way to add random points?
Any imput is welcome
Sorry I just figure out what was happening.
Apparently there was a file with the same name as my output and that is why I got the error codes.
I´m making my first game in Game Maker.
In the game i need to the user to draw a figure, for example a rectangle, and the game has to recognize the figure. How can i do this?
Thanks!
Well, that is a pretty complex task. To simplify it, you could ask him to place a succession of points, using the mouse coordinates in the click event, and automatically connect them with lines. If you store every point in the same ds_list structure, you will be able to check conditions of angle, distance, etc. This way, you can determine the shape. May I ask why you want to do this ?
The way I would solve this problem is pretty simple. I would create a few variables for each point when someone clicked on one of the points it would equal true. and wait for the player to click on the next point. If the player clicked on the next point i would call in a sprite as a line using image_angle to line both points up and wait for the player to click the next point.
Next I would have a step event waiting to see if all points were clicked and when they were then to either draw a triangle at those coordinates or place an sprite at the correct coordinates to fill in the triangle.
Another way you could do it would be to decide what those points would be and check against mouse_x, and mouse_y to see if that was a point and if it was then do as above. There are many ways to solve this problem. Just keep trying you will find one that works for your skill level and what you want to do.
You need to use draw_rectangle(x1, y1, x2, y2, outline) function. As for recognition of the figure, use point_in_rectangle(px, py, x1, y1, x2, y2).
I'm just wondering around with ideas cause i can't code right now. But listen to this, i think this could work.
We suppose that the user must keep his finger on touchscreen or an event is triggered and all data from the touch event is cleaned.
I assume that in future you could need to recognize other simple geometrical figures too.
1 : Set a fixed amount of pixels of movement defined dependent on the viewport dimension (i'll call this constant MOV from now on), for every MOV you store in a buffer (pointsBuf) the coordinates of the point where the finger is.
2 : Everytime a point is stored you calculate the average of either X and Y coordinates for every point. (Hold the previous average and a counter to reduce time complexity). Comparing them we now can know the direction and versus of the line. Store them in a 2D buffer (dirVerBuf).
3 : If a point is "drastically" different from the most plain average between the X and Y coordinates we can assume that the finger changed direction. This is where the test part of MOV comes critical, we must assure to calculate an angle now. Since only a Parkinsoned user would make really distorted lines we can assume at 95% that we're safe to take the 2nd point that didn't changed the average of the coordinate as vertex and let's say the last and the 2nd point before vertex to calculate the angle. You have now one angle. Test the best error margin of the user to find if the angle is about to be a 90, 60, 45, ecc.. degrees angle. Store in a new buffer (angBuf)
4 : Delete the values from pointsBuf and repeat step 2 and 3 until the user's finger leaves the screen.
5 : if four of the angles are of 90 degrees, the 4 versus and two of the directions are different, the last point is somewhat near (depending from MOV) the first angle stored and the two X lines and the Y lines are somewhat equal, but of different length between them, then you can connect the 4 angles using the four best values next to the 4 coordinates to make perfect rectangular shape.
It's late and i could have forgotten something, but with this method i think you could even figure out a triangle, a circle, ecc..
With just some edit and confronting.
EDIT: If you are really lazy you could instead use a much more space complexity heavy strategy. Just create a grid of rectangles or even triangles of a fixed dimension and check which one the finger has touched, connect their centers after you'have figured out the shape, obviously ignoring the "touched for mistake" ones. This would be extremely easy to draw even circles using the native functions. Gg.
Trying to implement EKG style "heartbeat" chart from a design and I'm having a hard time getting D3 to draw a path like I need.
The design spec states that the graph needs to return to nuetral/zero point between each and every data point, and that the curved path from the zero point should be close to the data point itself and rise sharply. See the attached images below
Here is the design....
And here is my attempt to match the curve with dummy data (black circle data points)...
The graph has a time scale X axis and a linear Y axis that ranges from 0 to 2 (my data points are 0,1, or 2 respectively). The line is using 'monotone' interpolation which is the least terrible looking.
Question:
Is there a better way to get this appearance without dummy data points?
Question-behind-the-question:
What is the best way to get D3 draw a custom paths (e.g. from a function)?
Sub-question:
Why does the monotone interpolation curve the path inward so sharply between the last 2 data points?
Any help is appreciated! The designers and client won't budge on this one, so I have to get it as close possible :(
I have many Polylgons. one contains different amount of points.
I'm drawing them using LINE_LOOP in 2d (orthographic).
Now i want to upload all of them to a single buffer.
The problem is when i'm drawing the buffer using glDrawArrays the last point of the first polygon is connected by line to the next point which is the first point of the second polygon, and so on.
I know that with glDrawElements i can send the indices and it is solving the issue. but for this, I need to send allot of data for drawing polygons with allot of points, and changing the LINE_LOOP to LINES.
Is there a way to draw only with the start and end indices of each polygon ?
For example
// My 2d polygons points are
polygons = [
0,0, 10,0, 10,5, 5,10, // polygon 1
20,20, 30,20, 30,30 // polygon 2
]
// First polygon is starting at 0, the second at index 8
// If there was function like this
draw(polygons, [0, 8]);
------ADDITION-----------------
We can do it in OpenGL by calling the glDrawMultiArray - Thanks for ratchet freak answer.
But in WebGL this function does not exists. Is there any alternative ?
you can use glMultiDrawArrays:
starts=[0,4,...]
counts=[4,3,...]
glMultiDrawArrays(GL_LINE_LOOP, starts, counts, starts.length);
otherwise with glDrawElements you can specify a primitive restart index
glEnable(GL_PRIMITIVE_RESTART);
glPrimitiveRestartIndex(65535);
index = [0,1,2,3,65535,4,5,6,65535,...]
//bind and fill GL_ELEMENT_ARRAY_BUFFER
glDrawElements(GL_LINE_LOOP, index.size, GL_UNSIGNED_INT, 0);
//will draw lines `0,1 1,2 2,3 3,0 4,5 5,6 6,4`
With WebGL, which AFAIK corresponds to ES 2.0 features, I don't think there's a way around making multiple draw calls. For your example, you would need two draw calls:
glDrawArrays(GL_LINE_LOOP, 0, 8);
glDrawArrays(GL_LINE_LOOP, 8, 6);
You could reduce it to a single draw call by using GL_LINES instead of GL_LINE_LOOP, but that means that your vertex array gets twice as large, because you need the start and end point of each line segment.
If you use an index buffer combined with GL_LINES, the increase is only 50%, as long as you don't have more than 64k vertices in a buffer. The vertex array itself remains at its original size, and you will need two GL_UNSIGNED_SHORT indices per vertex in addition. So that's 4 more bytes per vertex, on top of the 8 bytes (for 2 floats) you have for the vertex coordinates. This is probably your best option with the limited ES 2.0 feature set.
I don't know if its right forum. I'm posting question related to autocad. So please share link of forum (if I'm not allowed to ask it here)
How can I change point size (single point size 1/2/3) of point cloud (imported as pcg) in autocad.
POINT Command
Creates a point object
Draw menu: Point
Command line: point
Specify a point:
Points can act as nodes to which you can snap objects. You can specify a full three-dimensional location for a point. The current elevation is assumed if you omit the Z coordinate value.
The PDMODE and PDSIZE system variables control the appearance of point objects. PDMODE values 0, 2, 3, and 4 specify a figure to draw through the point. A value of 1 specifies that nothing is displayed.
Specifying the value 32, 64, or 96 selects a shape to draw around the point, in addition to the figure drawn through it:
PDSIZE controls the size of the point figures, except for PDMODE values 0 and 1. A setting of 0 generates the point at 5 percent of the drawing area height. A positive PDSIZE value specifies an absolute size for the point figures. A negative value is interpreted as a percentage of the viewport size. The size of all points is recalculated when the drawing is regenerated.
After you change PDMODE and PDSIZE, the appearance of existing points changes the next time AutoCAD regenerates the drawing.