how to generate random points and place it within a rectangular/ square boundary?
i have generated 'n' random points( say n= 50) and created line segments. so i want to place these linesegments within a rectangular boundary and eliminate those which lie outside the domain and keep those which are partially inside the domain.
could someone help me how to do the boundary conditions?
check out the intersect function.
here is one approach:
% generate a rectangular boundry
rectx = [0.1 0.1 0.9 0.9];
recty = [0.1 0.5 0.5 0.1];
rect = polyshape(rectx,recty);

% initialize a figure for display purposes
figure(1);clf
titles = [...
 "all lines";...
 "partially within";...
 "exclusively within"];
for i = 1:3
 subplot(1,3,i)
 hold on
 title(titles(i))
 plot(rect)
 xlim([0 1])
 ylim([0 1])
end

% define the number of line segments to generate
nlines = 25;

% initialize a structure to store the lines (if you need the data later)
lines = struct();

% generate each line, calculate it's intersection conditions, and plot
for i=1:nlines
 
 % generate points for a random line segment
 lines(i).points = rand(2);
 
 % section the line into parts at intersection with the rectangle
 [in, out] = intersect(rect, lines(i).points);
 
 % plot all the lines that were generated
 subplot(1,3,1)
 line(lines(i).points(:,1),lines(i).points(:,2))
 
 % plot lines that are partially within the boundary
 if isempty(in)==0
 subplot(1,3,2)
 line(lines(i).points(:,1),lines(i).points(:,2))
 end
 
 % plot lines that are exclusively within the boundary
 if isempty(out)==1
 subplot(1,3,3)
 line(lines(i).points(:,1),lines(i).points(:,2))
 end
end
here is the output:
if i get this right you are trying to sweep1 circle and have the sweeps come to a point.

if that be the case, you either need to have the sweep paths cross and go far enough past each other to come to a point (at right) or you can place the cross section on the inside of the sweep path rather than … Hi Uwe, You can make inside/outside strokes on non-closed paths using custom width profiles. Use thhe width tool (Shift+W) to make a stroke like this (hold alt to edit only one side of the stroke at a time): Then save it as a profile (bottom of the stroke panel). After that I think your path should be easy to make. ok so you can crate a firewall rule as follows:

soucre = internal network
service= tcp 9000 (you will need to create the definition)
destination = 128.194.162.30 (create either a host definition if it is always the same ip or dns host if it changes) in this we are asked to divide it in 2:3 ratioso, 3+2 = 55, number congruent of line segment is formed.i. firstly, we have to draw a line segment ab of length 7 cm. draw a line with an acute angle from point aii. point the compass on a, and cut the new line with some radiusplace the compass along the line and make 5 arcs. since we need 5 congruent parts, and name the last one as “g”iii. take length of bg as radius draw an arc from a just below it.again, take the length of ag as radius and draw an arc which cuts the previous arc from b, name the intersection point as hconnect b and hiv. taking the same length that we used in line ag, draw arcs along bh and name the points.v. connect the points along ag and bh. name the intercepts on the line ab as m, n, o & p.vi. thus we can divide a line segment as ao:ob = 6:4= 3:2 May as well promote my comment to an answer.


You need to add points to a `Curve2D` object, then adjust the control points of the curve, and then finally draw the curve. So here's some simple, almost pseudo code:



```
var array_of_line_points # This already has the vectors which describe our line
for point in array_of_line_points:
  # The "get_perpendicular_vector()" function returns a vector that's a copy of the point, yet has been slid along a line parallel to two neighboring points. The "distance" variable is how far the control point should be from the originating point.
  var control_point1 = get_perpendicular_vector(point, distance)
  var control_point2 = get_perpendicular_vector(point, -distance)
  curve.add_point(point, control_point1, control_point2)
# ...In the draw function
func _draw():
  draw_polyline(curve.get_baked_points(), red, 2.0)

```

I got the inspiration for this from [Rob Spencer's page on Spline Interpolation](http://scaledinnovation.com/analytics/splines/aboutSplines.html). I'd like to make this more thorough (i.e. defining the `get_perpendicular_vector()` function). But this is the best I can currently do. you can find the radius in the following way. 
write the equation of the line that is perpendicular to the given tangent line. this perpendicular goes through the stated center, and intersects the tangent; the perpendicular's slope is the negative reciprocal of the stated tangent line.
find the intersection (point t) of the tangent and radius line--then use the distance formula to find the radius, which is a segment from the stated center to the point t. using extrudeshape it is straightforward to obtain a bevel along the edges parallel to the extrusion direction.

<https://www.babylonjs-playground.com/#vkixd8>

as far as i know there is no function to produce bevels along all the edge but you can extrude and lathe a set of shapes to form such a mesh,… this is a type of problem called linear programming. you'll want to first define your variables:
 
x = number of motorcycles made
y = number of bikes made
 
 
 
then, write equations that bound your problem:
 
0 ≤ x ≤ 100    (you can't make more than 100 or fewer than 0 motorcycles)
0 ≤ y ≤ 250    (you can't make more than 250 or fewer than 0 bikes)
x + y ≤ 300    (you can't make more than 300 vehicles total)
 
 
 
now, plot those equations and find the region of intersection. the region should be some enclosed polygon where all the equations are true. so:
 
draw vertical lines at x = 0 and x = 100. the first equation is true between those lines.
 
draw horizontal lines at y = 0 and y = 250. the second equation is true between those lines.
 
draw a diagonal line at y = -x + 300. the third equation is true below that line.
 
the enclosed region is a pentagon, with one side formed by each of the five lines.
 
 
 
now, find the vertices of the region of intersection. since yours is a pentagon, you'll want to find five vertices. some are straightforward:
 
x = 0 and y = 0 intersect at (0, 0)
x = 0 and y = 250 intersect at (0, 250)
x = 100 and y = 0 intersect at (100, 0)
 
some are slightly less straightforward:
 
y = -x + 300 and x = 100 intersect where y = -100 + 300. that's (100, 200)
y = -x + 300 and y = 250 intersect where 250 = -x + 300, or -x = -50, or x = 50. that's (50, 250)
 
so, the five points of intersection are (0, 0), (0, 250), (100, 0), (100, 200), and (50, 250).
 
 
 
now, write an equation for profit, p:
 
p = 1220x + 380y
 
this equation will have its maximum value (and its minimum value) at one of those vertices. plug each vertex in to figure out which gives you the maximum profit:
 
p = 1220(0) + 380(0) = 0 + 0 = $0
p = 1220(0) + 380(250) = 0 + 95000 = $95,000
p = 1220(100) + 380(0) = 122000 + 0 = $122,000
p = 1220(100) + 380(200) = 122000 + 76000 = $198,000
p = 1220(50) + 380(250) = 61000 + 95000 = $156,000
 
your maximum profit is $198,000, at 100 motorcycles and 200 bikes. ```
frame.setVisible(true);
Graphics g = canvase.getGraphics();
g.drawRect(0,0,50,50);
```

Getgraphics take graphics when frame is visible, You just have to get graphics after setting it visible.... Simple Solution :) you could use kangaroo, but i don’t think it’s needed here.

instead i’d use inverse distance weighting to make a height field like this.

[sharp\_curves.gh](/uploads/short-url/a5wdkm9xiiwabwl6s0jpgf6ry7j.gh) (11.4 kb)

[[image]](https://aws1.discourse-cdn.com/mcneel/uploads/default/original/3x/d/c/dc85a5f42096a341409c4b4727a7d5066bd68745.png "image.png")

the key step here is making a mesh with vertices on the curves you want to keep sharp. one way of doing this is to split a s…