calculating coordinate points with VB.net - vb.net

I am trying to build a coordinates system but am having trouble with how to..
What I have sofar is a textbox that allows the user to enter a length. This length is user defined but never smaller then 610 in length since this is the minimum unit size we use to build timber frames. The overall length of a timber frame is infinite (well not really, but it is for what I want) the timber frame has beams every 610mm set apart from each other (this is a legal requirement) so I want my vb.net to set coordinates for each beam at intervals of 610 then write that coordinates system to a text based *.SCR file
AutoCAD uses the script file to automate drawing procedures to draw a beam of 180mm x 50mmx 50mm
BOX…. This emplys the AutoCAD tool needed for uses
0,0,0…This emplys a starting or base point
180,50,50…this is the end point that completes the beam
As you can see the script is very basic lets say I want a frame and in my textbox I type 1260
I know that my beams would look like the following in the script
Box
0,0,0
180,50,50
Box
0,660,0
180,660,50
Box
0,710,0
180,760,50
Box
0,810,0
180,860,0
Box
0,910,0
180,960,50
Box
0,1110,0
180,1160,50
Box
0,1210,0
180,1260,50
I need to build a new reference point each time from building of the previous, all these coordinates need to be worked out in VB.net and then recorded to the text based *scr file
How can I achieve this? I was pointedout towards the direction of arrays but doubt that???

the algorithm isn't clear.
see the increments at each step:
Box
0,0,0
180,50,50
Box
0,660,0 + 660
180,660,50 + 610
Box
0,710,0 + 50
180,760,50 + 100

Related

Teleport command in Minecraft data pack is ignoring parameters

I have this command that's supposed to teleport players when they reach a specific point on the x axis (regardless of y or z), for some reason it teleports everyone regardless of their position on the x axis
Here's the command - execute at #p[x=-5371] run tp #p[x=-5371] 5365 ~ ~
It's running on a custom data pack as a loop for each tick
It doesn't work like that. You cannot use x= alone in a selector, (x= and dx= must be used tgt; whereas dx is known as the volume selector). Also, you are scanning for the nearest player only and I would suggest for you to use #a which perform the task for all players.
To further elaborate, the volume selector takes resemblance to how you use the fill command, where you will enter the coordinates of the starting point and ending point respectively and the game will calculate the volume and the blocks affected depending on the points you entered, allowing you to fill an entire space with blocks of whatever kind. Similarly, working with the volume selector requires you to fill in 2 parameters, the starting coordinates (x=,y=,z=)
and the coordinate displacements (dx=,dy=,dz=).
Suppose starting coordinates (x, y, z)
Then ending coordinates = (x+dx, y+dy, z+dz)
This allows the game to draft a volume (block region) and evaluate the player position to see if it matches the volume.
An example:
To test for players at point (x=64, y=64, z=64) use the command
execute as #a[x=64,dx=0,y=64,dy=0,z=64,dz=0] run say DetectedPlayer
This draws a block region of 1x1 at point (64, 64, 64) and if the feet coordinate of a player lands in its proximity the player would say in chat "DetectedPlayer"
Albeit I really am not sure if you can have an infinitely extending volume of block region.
I interpret your question as how to set a border for players. In that case I recommend you to use /worldborder which is way more user friendly and conventional```
Here is the page you are looking for if you are hell bent on using the volume selector
https://minecraft.fandom.com/wiki/Target_selectors

Making cylindrical space in Repast Simphony?

I am trying to model the interior of an epithelial space and am stuck on movement around the interior edges of a cylindrical space. Basically, I'm trying to implement StickyBorders and keep agents on those borders in a cylindrical space that I am creating.
Is there a way to use cylindrical coordinates in Repast Simphony? I found this example (https://www.researchgate.net/publication/259695792_An_Agent-Based_Model_of_Vascular_Disease_Remodeling_in_Pulmonary_Arterial_Hypertension) where they seem to have done something similar, but the paper doesn't explain methods in much depth, and I don't believe this is an example in the repast simphony models.
Currently, I have a class of epithelial cells that are set up to form a cylinder and other agents start just inside that cylinder. To move, they are choosing their most desired spot (similar to the Zombie code) then pointing to a new location in the direction of that desired location within one grid square of that original location. They check that new point before moving to it and make sure that there are at least two other epithelial cells in the immediate moore neighborhood, to ensure they stay against the wall.
GridPoint intendedpt = new GridPoint((int)Math.rint(alongX),(int)Math.rint(alongY),(int)Math.rint(alongZ));
GridCellNgh<EpithelialCell> nearEpithelium = new GridCellNgh<EpithelialCell>(mac_grid, intendedpt, EpithelialCell.class, 1,1,1);
List<GridCell<EpithelialCell>> EpiCells = nearEpithelium.getNeighborhood(false);
int nearbyEpiCellsCount=0;
for (GridCell<EpithelialCell> cell: EpiCells) {
nearbyEpiCellsCount++;
}
if (nearbyEpiCellsCount<2) {
System.out.println(this + " leaving epithelial wall /r");
RunEnvironment.getInstance().pauseRun();
//TODO: where to go if false
}
I am wondering if there is a way to either set the boundaries of the space to be a cylinder or to check which side of the agent is against the wall and restrict its movement in that direction.
The sticky border code (StickyBorders.java) essentially just checks if the point that the agent moves to is beyond any of the space's dimensions, and if so the point is clamped to that dimension. So, for example, if the space is 3x4 and an agent's movement would take it to 4,2, then that point becomes 3,2 and the agent is placed there. Can you do something like that in this case? If not, can you edit your question to explain why not and maybe that will help us understand better.
The approach we took in that model was to use a 3D grid space with custom borders and query methods. The space itself was still Cartesian - we just visualized it as a cylinder using custom display code. Using the Cartesian grid was an reasonable approximation for this application since the cell dimensions were significantly smaller that the vessel radius, so curvature effects were neglected. The boundary conditions on the vessel space were wrap around in the angular dimension, so that cells could move continuously around the circumference of the vessel, and the axial boundary conditions were also wrapped, as we assumed a long enough vessel length that this would be reasonable. The wall thickness dimension had hard boundaries at the basement membrane (y=0) and at the fluid interface (y=wall thickness).
Depending on which type of space you are using, you will need to implement a PointTranslator or GridPointTranslator that performs the border functions. If you want specific examples of the code I suggest you reach out to the author's directly.

CorePlot - dynamic x-axis data using two arrays

This is more of an open discussion topic than anything else. Currently I'm storing 50 Float32 values in my NSMutableArray *voltageArray before I refresh my CPTPlot *plot. Every time I obtain 50 values, I remove the previous 50 from the voltageArray and repeat the process....always displaying the 50 values in "real time" on my plot.
However, the data I'm receiving (which is voltage coming from a Cypress BLE module equipped with a pressure transducer) is so quick that any variation (0.4 V to 4.0 V; no pressure to lots of pressure) cannot be seen on my graph. It just shows up as a straight line, varying up and down without showing increased or decreased slopes.
To show overall change, I wanted to take those 50 values, store them in the first index of another NSMutableArray *stampArray and use the index of stampArray to display information. Meanwhile, the numberOfRecordsForPlot: method would look like this:
- (NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plotnumberOfRecords {
return (DATA_PER_STAMP * _stampCount);
}
This would initially be 50, then after 50 pieces of data are captured from the BLE module, _stampCount would increase by one, and the number of records for plot would increase by 50 (till about 2500-10000 range, then I'd refresh the whole the thing and restart the process.)
Is this the right approach? How would I be able to make the first 50 points stay on the graph, while building the next 50, etc.? Imagine an y = x^2 graph, and what the graph looks like when applying integration (the whole breaking the area under the curve into rectangles).
Look at the "Real Time Plot" demo in the Plot Gallery example app included with Core Plot. It starts off with an empty plot, adding a new point each cycle until reaching the maximum number of points. After that, one old point is removed for each new one added so the total number stays constant. The demo uses a timer to pass random data to the plot, but your app can of course collect data from anywhere. Be sure to always interact with the graph from the main thread.
I doubt you'll be able to display 10,000 data points on one plot (does your display have enough pixels to resolve that many points?). If not, you'll get much better drawing performance if you filter and/or smooth the data to remove some of the points before sending them to the plot.

Is it Possible to so.?

I have searched lot regarding this. But there is no complete solution.
In my form i want to print the document upto the information contained in
my print document page (avoiding paper wasting instead of printing the whole page).
At the same time i should pass only one page [ie. i want to say paper height as
long as my data existing.so there is no possiblilty for next page]
Methods Used :
1. Using Print Document :
In OnBeginPrint Event
Dim xCustomSize As New PaperSize("Custom",820, 100)
xCustomSize.PaperName = PaperKind.Custom
With Me.DefaultPageSettings
.PaperSize = xCustomSize
End With
2. Without using print Document :
i followed below reference
http://www.codeproject.com/Articles/110314/POS-Printing-The-Easy-Way
In method 2 i didn't initialize the paper height.but it takes the default height as
something. and if the data exceeds,it continuous in next page.
I'm Using :
Microsoft Visual Studio 2008
Printer : Roll Paper Printer (Model : Bar Code Printer TT033-50)
Can Anyone help how to resolve this issue.
The closest to the requested implementation would probably be to do either...
A
input (and store/track) the length of the roll1 when replaced, a receipt is reprinted (due to auditing, tearing, or jamming, or running out of "ink", etc. - requiring B) and/or the paper is "manually" advanced (perhaps just on loading),
track how much tape you've printed2
when the next receipt to print would exceed tape remaining, ask the user to load more tape.
B
Implement a memory store of N transaction(s) so you can reprint them.
The closest vb.net has to 'as Any' is 'as Object'. vb.net no longer has the Variant type.
1 of receipt paper
2 There are 72 points "pt(s)" to the inch

connect line between two boxes avoiding passing others

I have several boxes (x,y,width,height) randomly scattered around, and some of them need to be linked from point (x1,y1) in box1 to point (x2,y2) in box2 by drawing a line. I am trying to figure a way to make such line avoid passing through any other boxes (other than box1 and box2) by drawing several straight interconnected lines to go around any box in the way (if it is not possible to go with one straight line). The problem is that I don't know an algorithm for such thing (let alone having a technical/common name for it). Would appreciate any help in the form of algorithm or expressed ideas.
Thanks
Assuming that the lines can't be diagonal, here's one simple way. It's based on BFS and will also find the shortest line connecting the points:
Just create a graph, containing one vertex for each point (x, y) and for each point the edges:
((x,y),(x+1,y)) ((x,y),(x-1,y)) ((x,y),(x,y+1)) ((x,y),(x,y-1))
But each of this edges must be present only if it doesn't overlap a box.
Now just do a plain BFS from point (x1,y1) to (x2,y2)
It's really easy to obtain also diagonal lines the same way but you will need 8 edges for each vertex, that are, in addition to the previouses 4:
((x,y),(x-1,y+1)) ((x,y),(x-1,y-1)) ((x,y),(x+1,y-1)) ((x,y),(x+1,y+1))
Still, each edge must be present only if it doesn't overlap a box.
EDIT
If you can't consider space divided into a grid, here's another possibility, it won't give you the very shortest path, though.
Create a graph, in which each box is a vertex and has an edge to any other box that can be reached without the line to overlap a third box. Now find the shortet path using dijkstra between box1 and box2 containing the two points.
Now consider each box to have a small countour that doesn't overlap any other box. This way you can link the entering and the exiting point of each box in the path found through dijistra, passing through the countour.
Put all (x,y) coords of the corners of the boxes in a set V
Add the start- and end coordinates to V.
Create a set of edges E connecting each corner that does not cross any box-side (except for the diagonals in the boxes).
How to check if a line crosses a box side can be done with this algorithm
Now use a path-finding algorithm of your choice, to find a path in the graph (V, E).
If you need a simple algorithm that finds the shortest path, just go with a BFS.
(This will produce a path that goes along the sides of some boxes. If this is undesirable, you could in step 1 put the points at some distance delta from the actual corners.)
If the edges may not be diagonal:
Create a large grid of lines that goes between the boxes.
Throw away the grid-edges that cross a box-side.
Find a path in the grid using a path-finding algorithm of your choice.