I'm trying to loft between a simple line and a complex curve and make a
"nice" set of regular faces.
I.e. two curves with quite different parameterisation. E.g. a straight line
100mm long and a parallel but highly wavy line, 100mm long.
In order to generate polygons between them, I'd like to be able to cut the
curve and the straight line into (say) 30 segments.
The curved line will have unequal length segments in most curve basis
systems (e.g. Bezier).
But I'd like them to be nearly the same so I get a nice regular surface.
Does anyone know of an OpenSCAD lib that allows me to define a curve and a
straight line, and when broken into segments, cuts linearly along the path
rather than linearly through (say) knot values or other non-linear
mechanisms ?
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Don't know if there's any lib, but I want to do this for a while (if I
understand your question correctly). I've thought of an approach, just
haven't got time to do it. So this is what I would do:
http://forum.openscad.org/file/n13707/forum_1596_smooth_curves_.png
in which intervals between red dots are uneven. The challenge is to make
them more or less even.
The first order approach is to make more red dots for longer line
segments at the time of their generation, based on the observation that the
intervals are proportional to the line segment length; This would probably
get most of the job done.
Further refinement needs to take into account the curvature, for example,
the curve between B-C would need more red dots than that between A-B. This
is decided by 2 control handlers (and other parameters) needed to calc the
Bezier curve. So at the time of calc Bezier pts, take this into account and
make more pts as needed.
$ Runsun Pan, PhD
$ -- libs: doctest , faces ( git ), offliner ( git );
tips: hash( 1 , 2 ), sweep , var
$ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13707.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
or use a parameterisation that counts equal distances along eth actual
resultign curve. I know this is easier in some base matrices than others.
My problem is specifically this
http://forum.openscad.org/file/n13710/curves.png
The two lines have widely varying sampling as a result of their curvature. I
want to make a mesh between them so a slicing like the red lines is better
for me than the current slicing which is the blue dots.
but sounds like no clear existing solution :(
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13710.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
What are available to you, the functions that generate those points, or just
points ?
It looks like that you do have a function, otherwise the top line won't be a
curve with just 3 dots.
$ Runsun Pan, PhD
$ -- libs: doctest , faces ( git ), offliner ( git );
tips: hash( 1 , 2 ), sweep , var
$ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13712.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Yes I've oversimplified that. I'm happy to generate the curve in any way at
all.
E.g. In inkscape and export as a series of straight line segs, or as XY knot
points, manually by examination in OpenSCAD, or any other way :)
Cheers...
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13714.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hi Neon, your answer is not clear ... "you are happy to generate the curve",
or "you already are able to generate the curve"?
Instead of attempting to get an verbal understanding of where the difficulty
really is, why don't you just show some data? That would make help come much
easier.
Neon22 wrote
Yes I've oversimplified that. I'm happy to generate the curve in any way
at all.
E.g. In inkscape and export as a series of straight line segs, or as XY
knot points, manually by examination in OpenSCAD, or any other way :)
Cheers...
$ Runsun Pan, PhD
$ -- libs: doctest , faces ( git ), offliner ( git );
tips: hash( 1 , 2 ), sweep , var
$ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13719.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I am sorry I cannot make myself understood. I am prepared to make the curve
in any way at all if I can get the end result.
In the interests of continued discussion here is a sample below.
Two curves exported from Inkscape and - here - shown as rotate_extrudes.
However the result I am looking for would have these two curves alternating
around the circumference of the rotated volume. Wavy, then smooth, then
wavy, then smooth, etc...
The resulting volume would have smooth and wavy sections in a single volume.
//
wavy_points =
[[-74.350520,-315.826595],[-66.629180,-315.108485],[-61.646323,-314.561548],[-56.010858,-313.760231],[-49.794423,-312.607689],[-43.068656,-311.007077],[-35.905194,-308.861551],[-28.375676,-306.074266],[-24.496033,-304.409701],[-20.551740,-302.548378],[-16.551752,-300.478194],[-12.505023,-298.187043],[-8.420509,-295.662818],[-4.307163,-292.893415],[-0.173942,-289.866728],[3.970201,-286.570651],[8.116311,-282.993078],[12.255433,-279.121905],[16.378612,-274.945025],[20.476893,-270.450334],[24.541322,-265.625724],[28.562945,-260.459092],[32.532806,-254.938330],[36.441950,-249.051335],[38.136582,-246.692439],[40.156640,-244.292852],[44.695745,-239.372400],[46.976145,-236.851932],[49.104680,-234.291568],[50.962026,-231.691506],[52.428860,-229.051945],[52.935914,-227.717414],[53.243471,-226.373083],[53.378838,-225.018977],[53.369319,-223.655120],[53.024847,-220.898253],[52.428500,-218.102681],[51.798722,-215.268603],[51.353956,-212.396217],[51.312648,-209.485722],[51.511553,-208.016245],[51.893240,-206.537315],[52.456864,-205.096561],[53.168470,-203.733329],[54.946167,-201.189858],[57.047401,-198.807760],[59.293245,-196.487887],[61.504769,-194.131098],[63.503043,-191.638245],[65.109140,-188.910186],[65.709206,-187.426971],[66.144130,-185.847775],[66.370434,-184.202428],[66.379413,-182.530689],[66.200854,-180.835068],[65.864548,-179.118072],[64.837849,-175.629992],[63.537629,-172.086515],[62.202199,-168.507710],[61.069872,-164.913643],[60.378962,-161.324382],[60.273510,-159.537825],[60.367780,-157.759995],[60.700666,-155.944968],[61.268016,-154.051793],[62.966968,-150.070833],[65.186366,-145.896786],[67.647938,-141.609328],[70.073410,-137.288129],[72.184513,-133.012864],[73.035215,-130.917354],[73.702973,-128.863205],[74.153003,-126.860375],[74.350520,-124.918825],[74.281851,-123.007120],[73.978027,-121.087203],[73.471320,-119.159099],[72.794003,-117.222834],[71.056629,-113.325916],[69.024086,-109.396649],[66.954556,-105.435230],[65.106219,-101.441860],[64.345680,-99.433254],[63.737257,-97.416735],[63.313223,-95.392327],[63.105850,-93.360055],[63.165211,-91.300901],[63.493360,-89.199163],[64.050548,-87.059833],[64.797023,-84.887903],[66.698828,-80.466208],[68.880766,-75.974016],[71.024828,-71.451262],[72.813004,-66.937882],[73.474257,-64.697187],[73.927284,-62.473811],[74.132336,-60.272746],[74.049660,-58.098985],[73.719394,-55.955863],[73.223069,-53.840094],[71.821592,-49.670846],[70.023938,-45.551701],[68.008811,-41.443121],[65.954920,-37.305567],[64.040970,-33.099501],[62.445667,-28.785383],[61.823355,-26.575449],[61.347720,-24.323675],[57.874046,-5.905632],[53.765900,12.950570],[49.016170,32.232222],[43.617744,51.926614],[37.563509,72.021035],[30.846353,92.502776],[23.459165,113.359128],[15.394831,134.577379],[6.646241,156.144820],[-2.793720,178.048741],[-12.932161,200.276433],[-23.776197,222.815185],[-35.332938,245.652287],[-47.609498,268.775029],[-60.612988,292.170702],[-74.350520,315.826595]];
smooth_points =
[[-71.899238,-315.826600],[-64.177899,-315.108490],[-59.195041,-314.561553],[-53.559576,-313.760236],[-47.343141,-312.607694],[-40.617373,-311.007082],[-33.453912,-308.861556],[-25.924393,-306.074271],[-22.044750,-304.409706],[-18.100457,-302.548383],[-14.100468,-300.478199],[-10.053739,-298.187048],[-5.969224,-295.662823],[-1.855879,-292.893420],[2.277343,-289.866733],[6.421487,-286.570656],[10.567597,-282.993083],[14.706720,-279.121910],[18.829899,-274.945030],[22.928181,-270.450339],[26.992612,-265.625729],[31.014235,-260.459097],[34.984096,-254.938335],[38.893242,-249.051340],[41.813186,-244.292856],[44.603850,-239.372404],[47.264346,-234.291572],[49.793783,-229.051949],[52.191273,-223.655124],[54.455927,-218.102685],[56.586856,-212.396222],[58.583171,-206.537323],[60.443983,-200.527576],[62.168403,-194.368571],[63.755541,-188.061896],[65.204509,-181.609141],[66.514418,-175.011893],[67.684378,-168.271741],[68.713501,-161.390275],[69.600898,-154.369082],[70.345679,-147.209752],[70.946956,-139.913874],[71.403839,-132.483036],[71.715440,-124.918827],[71.899238,-109.396651],[71.491238,-93.360055],[70.484328,-76.821750],[68.871394,-59.794445],[66.645326,-42.290851],[63.799010,-24.323678],[60.325335,-5.905634],[56.217189,12.950569],[51.467458,32.232221],[46.069031,51.926613],[40.014796,72.021035],[33.297641,92.502777],[25.910452,113.359129],[17.846119,134.577381],[9.097528,156.144823],[-0.342432,178.048745],[-10.480874,200.276437],[-21.324910,222.815189],[-32.881653,245.652291],[-45.158213,268.775034],[-58.161704,292.170707],[-71.899238,315.826600]];
profile_scale = 25.4/90; //made in inkscape in mm
Faceted = 42;
Delta = 0.1;
//
function min_x(shape_points) = min([ for (x = shape_points) min(x[0])]);
function max_x(shape_points) = max([ for (x = shape_points) max(x[0])]);
function min_y(shape_points) = min([ for (x = shape_points) min(x[1])]);
function max_y(shape_points) = max([ for (x = shape_points) max(x[1])]);
//
echo(str("wavy=",len(wavy_points)));
echo(str("smooth=",len(smooth_points)));
module build_rotated(shape_points, new_height, new_width) {
minx = min_x(shape_points)* profile_scale;
maxx = max_x(shape_points)* profile_scale;
p_width = (maxx - minx);
miny = min_y(shape_points) * profile_scale;
maxy = max_y(shape_points) * profile_scale;
p_height = maxy-miny;
y_scale = new_height/p_height;
x_scale = new_width /(p_width*2);
rotate_extrude($fn=Faceted, convexity = 8) {
scale([x_scale,y_scale])
// add 0.1 so there is tiny hole in middle so F6 works
translate([-minx+Delta, maxy]) // scale profile
scale([profile_scale, -profile_scale])
polygon(shape_points);
}
// fill in tiny offset hole to ensure F6 works
fix_start = shape_points[0][1] * profile_scale;
fix_end = shape_points[len(shape_points)-1][1] * profile_scale;
echo(shape_points[0],fix_start, fix_end);
translate([0,0,y_scale*(-fix_end+maxy)])
cylinder(h=y_scale*(fix_end-fix_start), r=0.2+Delta*y_scale, $fn=Faceted);
//
}
// shown here two rotate_extrudes , one of each shape_points
// However we want to make a surface with alternating vertical profiles of
the two polygons.
build_rotated(wavy_points, 100, 30);
translate([40,0,0])
build_rotated(smooth_points, 100, 30);
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13720.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I am sorry I cannot make myself understood. I am prepared to make the curve
in any way at all if I can get the end result.
In the interests of continued discussion here is a sample below.
Two curves exported from Inkscape and - here - shown as rotate_extrudes.
However the result I am looking for would have these two curves alternating
around the circumference of the rotated volume. Wavy, then smooth, then
wavy, then smooth, etc...
The resulting volume would have smooth and wavy sections in a single
volume.
//
wavy_points =
[[-74.350520,-315.826595],[-66.629180,-315.108485],[-61.646323,-314.561548],[-56.010858,-313.760231],[-49.794423,-312.607689],[-43.068656,-311.007077],[-35.905194,-308.861551],[-28.375676,-306.074266],[-24.496033,-304.409701],[-20.551740,-302.548378],[-16.551752,-300.478194],[-12.505023,-298.187043],[-8.420509,-295.662818],[-4.307163,-292.893415],[-0.173942,-289.866728],[3.970201,-286.570651],[8.116311,-282.993078],[12.255433,-279.121905],[16.378612,-274.945025],[20.476893,-270.450334],[24.541322,-265.625724],[28.562945,-260.459092],[32.532806,-254.938330],[36.441950,-249.051335],[38.136582,-246.692439],[40.156640,-244.292852],[44.695745,-239.372400],[46.976145,-236.851932],[49.104680,-234.291568],[50.962026,-231.691506],[52.428860,-229.051945],[52.935914,-227.717414],[53.243471,-226.373083],[53.378838,-225.018977],[53.369319,-223.655120],[53.024847,-220.898253],[52.428500,-218.102681],[51.798722,-215.268603],[51.353956,-212.396217],[51.312648,-209.485722],[51.511553,-208.016245],[51.893240,-206.537315],[52.456864,-205.096561],[53.168470,-203.733329],[54.946167,-201.189858],[57.047401,-198.807760],[59.293245,-196.487887],[61.504769,-194.131098],[63.503043,-191.638245],[65.109140,-188.910186],[65.709206,-187.426971],[66.144130,-185.847775],[66.370434,-184.202428],[66.379413,-182.530689],[66.200854,-180.835068],[65.864548,-179.118072],[64.837849,-175.629992],[63.537629,-172.086515],[62.202199,-168.507710],[61.069872,-164.913643],[60.378962,-161.324382],[60.273510,-159.537825],[60.367780,-157.759995],[60.700666,-155.944968],[61.268016,-154.051793],[62.966968,-150.070833],[65.186366,-145.896786],[67.647938,-141.609328],[70.073410,-137.288129],[72.184513,-133.012864],[73.035215,-130.917354],[73.702973,-128.863205],[74.153003,-126.860375],[74.350520,-124.918825],[74.281851,-123.007120],[73.978027,-121.087203],[73.471320,-119.159099],[72.794003,-117.222834],[71.056629,-113.325916],[69.024086,-109.396649],[66.954556,-105.435230],[65.106219,-101.441860],[64.345680,-99.433254],[63.737257,-97.416735],[63.313223,-95.392327],[63.105850,-93.360055],[63.165211,-91.300901],[63.493360,-89.199163],[64.050548,-87.059833],[64.797023,-84.887903],[66.698828,-80.466208],[68.880766,-75.974016],[71.024828,-71.451262],[72.813004,-66.937882],[73.474257,-64.697187],[73.927284,-62.473811],[74.132336,-60.272746],[74.049660,-58.098985],[73.719394,-55.955863],[73.223069,-53.840094],[71.821592,-49.670846],[70.023938,-45.551701],[68.008811,-41.443121],[65.954920,-37.305567],[64.040970,-33.099501],[62.445667,-28.785383],[61.823355,-26.575449],[61.347720,-24.323675],[57.874046,-5.905632],[53.765900,12.950570],[49.016170,32.232222],[43.617744,51.926614],[37.563509,72.021035],[30.846353,92.502776],[23.459165,113.359128],[15.394831,134.577379],[6.646241,156.144820],[-2.793720,178.048741],[-12.932161,200.276433],[-23.776197,222.815185],[-35.332938,245.652287],[-47.609498,268.775029],[-60.612988,292.170702],[-74.350520,315.826595]];
smooth_points =
[[-71.899238,-315.826600],[-64.177899,-315.108490],[-59.195041,-314.561553],[-53.559576,-313.760236],[-47.343141,-312.607694],[-40.617373,-311.007082],[-33.453912,-308.861556],[-25.924393,-306.074271],[-22.044750,-304.409706],[-18.100457,-302.548383],[-14.100468,-300.478199],[-10.053739,-298.187048],[-5.969224,-295.662823],[-1.855879,-292.893420],[2.277343,-289.866733],[6.421487,-286.570656],[10.567597,-282.993083],[14.706720,-279.121910],[18.829899,-274.945030],[22.928181,-270.450339],[26.992612,-265.625729],[31.014235,-260.459097],[34.984096,-254.938335],[38.893242,-249.051340],[41.813186,-244.292856],[44.603850,-239.372404],[47.264346,-234.291572],[49.793783,-229.051949],[52.191273,-223.655124],[54.455927,-218.102685],[56.586856,-212.396222],[58.583171,-206.537323],[60.443983,-200.527576],[62.168403,-194.368571],[63.755541,-188.061896],[65.204509,-181.609141],[66.514418,-175.011893],[67.684378,-168.271741],[68.713501,-161.390275],[69.600898,-154.369082],[70.345679,-147.209752],[70.946956,-139.913874],[71.403839,-132.483036],[71.715440,-124.918827],[71.899238,-109.396651],[71.491238,-93.360055],[70.484328,-76.821750],[68.871394,-59.794445],[66.645326,-42.290851],[63.799010,-24.323678],[60.325335,-5.905634],[56.217189,12.950569],[51.467458,32.232221],[46.069031,51.926613],[40.014796,72.021035],[33.297641,92.502777],[25.910452,113.359129],[17.846119,134.577381],[9.097528,156.144823],[-0.342432,178.048745],[-10.480874,200.276437],[-21.324910,222.815189],[-32.881653,245.652291],[-45.158213,268.775034],[-58.161704,292.170707],[-71.899238,315.826600]];
profile_scale = 25.4/90; //made in inkscape in mm
Faceted = 42;
Delta = 0.1;
//
function min_x(shape_points) = min([ for (x = shape_points) min(x[0])]);
function max_x(shape_points) = max([ for (x = shape_points) max(x[0])]);
function min_y(shape_points) = min([ for (x = shape_points) min(x[1])]);
function max_y(shape_points) = max([ for (x = shape_points) max(x[1])]);
//
echo(str("wavy=",len(wavy_points)));
echo(str("smooth=",len(smooth_points)));
module build_rotated(shape_points, new_height, new_width) {
minx = min_x(shape_points)* profile_scale;
maxx = max_x(shape_points)* profile_scale;
p_width = (maxx - minx);
miny = min_y(shape_points) * profile_scale;
maxy = max_y(shape_points) * profile_scale;
p_height = maxy-miny;
y_scale = new_height/p_height;
x_scale = new_width /(p_width*2);
rotate_extrude($fn=Faceted, convexity = 8) {
scale([x_scale,y_scale])
// add 0.1 so there is tiny hole in middle so F6 works
translate([-minx+Delta, maxy]) // scale profile
scale([profile_scale, -profile_scale])
polygon(shape_points);
}
// fill in tiny offset hole to ensure F6 works
fix_start = shape_points[0][1] * profile_scale;
fix_end = shape_points[len(shape_points)-1][1] * profile_scale;
echo(shape_points[0],fix_start, fix_end);
translate([0,0,y_scale*(-fix_end+maxy)])
cylinder(h=y_scale*(fix_end-fix_start),
r=0.2+Delta*y_scale, $fn=Faceted);
//
}
// shown here two rotate_extrudes , one of each shape_points
// However we want to make a surface with alternating vertical profiles of
the two polygons.
build_rotated(wavy_points, 100, 30);
translate([40,0,0])
build_rotated(smooth_points, 100, 30);
--
View this message in context:
http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13720.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
stempeldergeschichte@googlemail.com karsten@rohrbach.de
P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.
P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.
Enjoy!
That's pretty close. You have 6 of each I think.
However the transition between them is not smooth. It is stepped. That is
why I'm trying to do it with the same number of segments in each of the two
curves.
My curves above are IIRC 124 segments for the wavy and 60 for the smooth.
If they were both 124 then I could make a smooth transition between curves
by stitching faces.
I can simulate it by scaling two 90 degree out of phase objects but these
are arbitrary attempts to solve a basic problem of curve paramaterisation.
E.g. If I had a bspline (or any other basis function curve) with 4 knots and
another with 2. How do I get the same number of segments(of even length)
when sampling them.
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13725.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hi Neon, it seems that your problem can be approached with simple
interpolation, based on the observation that each line segment between two
points is, or nearly is, a straight line.
The following is the smooth_points[25] to [26] of your data (blue). Just
increase the y by dy (set to 2.35 here) repeatedly (red horizontal lines),
see if it gets larger than any given smooth_points[i].y. If yes, calc the
slope between smooth_points[i] and [j] (green). The interpolated point at
that y can thus be obtained (I250, I251 and I261).
http://forum.openscad.org/file/n13729/interpolation_1597_Neon22.png
Here are the functions that generate the I250, I251 and I261 in the above
graph:
function slope(pts,i)=
(pts[i+1][1]-pts[i][1] ) / (pts[i+1][0]-pts[i][0] );
function interpolate( pts, i, y=begY )=
let( slope= slope( pts, i ) )
[ pts[i][0]+ (y-pts[i][1])/slope, y ];
I250= interpolate( smooth_points, 25);
I251= interpolate( smooth_points, 25, y=begY+dy);
I260= interpolate( smooth_points, 26, y=begY+dy*2);
This is to answer your question in the first post. To reach your final
destination, more manipulations are needed. But lets see how you will take
it from here.
$ Runsun Pan, PhD
$ -- libs: doctest , faces ( git ), offliner ( git );
tips: hash( 1 , 2 ), sweep , var
$ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly
--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13729.html
Sent from the OpenSCAD mailing list archive at Nabble.com.