discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Center of a 2d object

ME
Mark Erbaugh
Mon, Nov 11, 2024 3:46 PM

Is there programmatic way to get the center (or any other reference, such as a corner) point of a 2d object at an arbitrary position in the XY plane?

Mark

Is there programmatic way to get the center (or any other reference, such as a corner) point of a 2d object at an arbitrary position in the XY plane? Mark
SP
Sanjeev Prabhakar
Mon, Nov 11, 2024 4:22 PM

Its long time since I have written any function in openSCAD, but this
should work

p0=[[2,0],[10,5],[5,10]];

function center_point(p,p1=[0,0,0],n=0)=
n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1);

echo(center_point(p0));

basically center of mass for any object would be
sum of all the points(2d or 3d coordinates)/ number of points

On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

Is there programmatic way to get the center (or any other reference, such
as a corner) point of a 2d object at an arbitrary position in the XY plane?

Mark


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Its long time since I have written any function in openSCAD, but this should work p0=[[2,0],[10,5],[5,10]]; function center_point(p,p1=[0,0,0],n=0)= n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1); echo(center_point(p0)); basically center of mass for any object would be sum of all the points(2d or 3d coordinates)/ number of points On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss < discuss@lists.openscad.org> wrote: > Is there programmatic way to get the center (or any other reference, such > as a corner) point of a 2d object at an arbitrary position in the XY plane? > > Mark > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
GS
Guenther Sohler
Mon, Nov 11, 2024 4:25 PM

Issue IS that in openscad you dont have Access to the objects vertices 😞

.

Sanjeev Prabhakar via Discuss discuss@lists.openscad.org schrieb am Mo.,
11. Nov. 2024, 17:22:

Its long time since I have written any function in openSCAD, but this
should work

p0=[[2,0],[10,5],[5,10]];

function center_point(p,p1=[0,0,0],n=0)=
n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1);

echo(center_point(p0));

basically center of mass for any object would be
sum of all the points(2d or 3d coordinates)/ number of points

On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

Is there programmatic way to get the center (or any other reference, such
as a corner) point of a 2d object at an arbitrary position in the XY plane?

Mark


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Issue IS that in openscad you dont have Access to the objects vertices 😞 . Sanjeev Prabhakar via Discuss <discuss@lists.openscad.org> schrieb am Mo., 11. Nov. 2024, 17:22: > Its long time since I have written any function in openSCAD, but this > should work > > p0=[[2,0],[10,5],[5,10]]; > > function center_point(p,p1=[0,0,0],n=0)= > n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1); > > echo(center_point(p0)); > > basically center of mass for any object would be > sum of all the points(2d or 3d coordinates)/ number of points > > On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss < > discuss@lists.openscad.org> wrote: > >> Is there programmatic way to get the center (or any other reference, such >> as a corner) point of a 2d object at an arbitrary position in the XY plane? >> >> Mark >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Mon, Nov 11, 2024 4:32 PM

oh I thought to make a polygon in openSCAD you have to define points anyway.

Nevermind, I wrote a recursive function after a long time in openSCAD

On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Issue IS that in openscad you dont have Access to the objects vertices 😞

.

Sanjeev Prabhakar via Discuss discuss@lists.openscad.org schrieb am
Mo., 11. Nov. 2024, 17:22:

Its long time since I have written any function in openSCAD, but this
should work

p0=[[2,0],[10,5],[5,10]];

function center_point(p,p1=[0,0,0],n=0)=
n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1);

echo(center_point(p0));

basically center of mass for any object would be
sum of all the points(2d or 3d coordinates)/ number of points

On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

Is there programmatic way to get the center (or any other reference,
such as a corner) point of a 2d object at an arbitrary position in the XY
plane?

Mark


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

oh I thought to make a polygon in openSCAD you have to define points anyway. Nevermind, I wrote a recursive function after a long time in openSCAD On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss < discuss@lists.openscad.org> wrote: > Issue IS that in openscad you dont have Access to the objects vertices 😞 > > . > > Sanjeev Prabhakar via Discuss <discuss@lists.openscad.org> schrieb am > Mo., 11. Nov. 2024, 17:22: > >> Its long time since I have written any function in openSCAD, but this >> should work >> >> p0=[[2,0],[10,5],[5,10]]; >> >> function center_point(p,p1=[0,0,0],n=0)= >> n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1); >> >> echo(center_point(p0)); >> >> basically center of mass for any object would be >> sum of all the points(2d or 3d coordinates)/ number of points >> >> On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> Is there programmatic way to get the center (or any other reference, >>> such as a corner) point of a 2d object at an arbitrary position in the XY >>> plane? >>> >>> Mark >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Mon, Nov 11, 2024 5:25 PM



oh I thought to make a polygon in openSCAD you have to define points anyway.

To make a polygon primitive, yes.

But you can also get 2D objects from Boolean combinations of other 2D objects, from projection(), from imported 2D objects, et cetera, and there’s currently no way to retrieve the coordinates of such an object.

It’s exactly the same situation as for 3D objects, but flatter.

 > oh I thought to make a polygon in openSCAD you have to define points anyway. To make a polygon primitive, yes. But you can also get 2D objects from Boolean combinations of other 2D objects, from projection(), from imported 2D objects, et cetera, and there’s currently no way to retrieve the coordinates of such an object. It’s exactly the same situation as for 3D objects, but flatter.
TA
Todd Allen
Mon, Nov 11, 2024 5:42 PM

Use the 2d shape functions from BOSL2 which return geometry and you can
manipulate it with their functions such as rotate, scale, union and
difference which return geometry.  BOSL2 also has functions such
as path_closest_point() which you might use to find corners and calculate a
center point.  The BOSL2 code can also provide a starting point to modify
into your own solutions when there isn't a routine in the library that can
do what you need.

On Mon, Nov 11, 2024 at 10:33 AM Sanjeev Prabhakar via Discuss <
discuss@lists.openscad.org> wrote:

oh I thought to make a polygon in openSCAD you have to define points
anyway.

Nevermind, I wrote a recursive function after a long time in openSCAD

On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Issue IS that in openscad you dont have Access to the objects vertices 😞

.

Sanjeev Prabhakar via Discuss discuss@lists.openscad.org schrieb am
Mo., 11. Nov. 2024, 17:22:

Its long time since I have written any function in openSCAD, but this
should work

p0=[[2,0],[10,5],[5,10]];

function center_point(p,p1=[0,0,0],n=0)=
n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1);

echo(center_point(p0));

basically center of mass for any object would be
sum of all the points(2d or 3d coordinates)/ number of points

On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

Is there programmatic way to get the center (or any other reference,
such as a corner) point of a 2d object at an arbitrary position in the XY
plane?

Mark


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Use the 2d shape functions from BOSL2 which return geometry and you can manipulate it with their functions such as rotate, scale, union and difference which return geometry. BOSL2 also has functions such as path_closest_point() which you might use to find corners and calculate a center point. The BOSL2 code can also provide a starting point to modify into your own solutions when there isn't a routine in the library that can do what you need. On Mon, Nov 11, 2024 at 10:33 AM Sanjeev Prabhakar via Discuss < discuss@lists.openscad.org> wrote: > oh I thought to make a polygon in openSCAD you have to define points > anyway. > > Nevermind, I wrote a recursive function after a long time in openSCAD > > On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss < > discuss@lists.openscad.org> wrote: > >> Issue IS that in openscad you dont have Access to the objects vertices 😞 >> >> . >> >> Sanjeev Prabhakar via Discuss <discuss@lists.openscad.org> schrieb am >> Mo., 11. Nov. 2024, 17:22: >> >>> Its long time since I have written any function in openSCAD, but this >>> should work >>> >>> p0=[[2,0],[10,5],[5,10]]; >>> >>> function center_point(p,p1=[0,0,0],n=0)= >>> n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1); >>> >>> echo(center_point(p0)); >>> >>> basically center of mass for any object would be >>> sum of all the points(2d or 3d coordinates)/ number of points >>> >>> On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss < >>> discuss@lists.openscad.org> wrote: >>> >>>> Is there programmatic way to get the center (or any other reference, >>>> such as a corner) point of a 2d object at an arbitrary position in the XY >>>> plane? >>>> >>>> Mark >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jon Bondy
Mon, Nov 11, 2024 5:49 PM

I love it!

<grin>

On 11/11/2024 12:25 PM, Jordan Brown via Discuss wrote:

It’s exactly the same situation as for 3D objects, but flatter.

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I love it! <grin> On 11/11/2024 12:25 PM, Jordan Brown via Discuss wrote: > It’s exactly the same situation as for 3D objects, but flatter. > -- This email has been checked for viruses by AVG antivirus software. www.avg.com
AM
Adrian Mariano
Mon, Nov 11, 2024 5:51 PM

I think maybe you meant to say that BOSL2 has functions that return point
lists and you can manipulate them with rotate, scale, union, difference
etc.  In addition, BOSL2 has centroid() which computes the centroid
(center of mass) of a polygon or polyhedron, which is not simply the
average of the vertices.  You can compute the average of the vertices---if
you want that value instead---with mean().

On Mon, Nov 11, 2024 at 12:43 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

Use the 2d shape functions from BOSL2 which return geometry and you can
manipulate it with their functions such as rotate, scale, union and
difference which return geometry.  BOSL2 also has functions such
as path_closest_point() which you might use to find corners and calculate a
center point.  The BOSL2 code can also provide a starting point to modify
into your own solutions when there isn't a routine in the library that can
do what you need.

On Mon, Nov 11, 2024 at 10:33 AM Sanjeev Prabhakar via Discuss <
discuss@lists.openscad.org> wrote:

oh I thought to make a polygon in openSCAD you have to define points
anyway.

Nevermind, I wrote a recursive function after a long time in openSCAD

On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Issue IS that in openscad you dont have Access to the objects vertices 😞

.

Sanjeev Prabhakar via Discuss discuss@lists.openscad.org schrieb am
Mo., 11. Nov. 2024, 17:22:

Its long time since I have written any function in openSCAD, but this
should work

p0=[[2,0],[10,5],[5,10]];

function center_point(p,p1=[0,0,0],n=0)=
n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1);

echo(center_point(p0));

basically center of mass for any object would be
sum of all the points(2d or 3d coordinates)/ number of points

On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

Is there programmatic way to get the center (or any other reference,
such as a corner) point of a 2d object at an arbitrary position in the XY
plane?

Mark


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I think maybe you meant to say that BOSL2 has functions that return point lists and you can manipulate them with rotate, scale, union, difference etc. In addition, BOSL2 has centroid() which computes the centroid (center of mass) of a polygon or polyhedron, which is not simply the average of the vertices. You can compute the average of the vertices---if you want that value instead---with mean(). On Mon, Nov 11, 2024 at 12:43 PM Todd Allen via Discuss < discuss@lists.openscad.org> wrote: > Use the 2d shape functions from BOSL2 which return geometry and you can > manipulate it with their functions such as rotate, scale, union and > difference which return geometry. BOSL2 also has functions such > as path_closest_point() which you might use to find corners and calculate a > center point. The BOSL2 code can also provide a starting point to modify > into your own solutions when there isn't a routine in the library that can > do what you need. > > On Mon, Nov 11, 2024 at 10:33 AM Sanjeev Prabhakar via Discuss < > discuss@lists.openscad.org> wrote: > >> oh I thought to make a polygon in openSCAD you have to define points >> anyway. >> >> Nevermind, I wrote a recursive function after a long time in openSCAD >> >> On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> Issue IS that in openscad you dont have Access to the objects vertices 😞 >>> >>> . >>> >>> Sanjeev Prabhakar via Discuss <discuss@lists.openscad.org> schrieb am >>> Mo., 11. Nov. 2024, 17:22: >>> >>>> Its long time since I have written any function in openSCAD, but this >>>> should work >>>> >>>> p0=[[2,0],[10,5],[5,10]]; >>>> >>>> function center_point(p,p1=[0,0,0],n=0)= >>>> n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1); >>>> >>>> echo(center_point(p0)); >>>> >>>> basically center of mass for any object would be >>>> sum of all the points(2d or 3d coordinates)/ number of points >>>> >>>> On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss < >>>> discuss@lists.openscad.org> wrote: >>>> >>>>> Is there programmatic way to get the center (or any other reference, >>>>> such as a corner) point of a 2d object at an arbitrary position in the XY >>>>> plane? >>>>> >>>>> Mark >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
TA
Todd Allen
Mon, Nov 11, 2024 6:29 PM

I think maybe you meant to say that BOSL2 has functions that return point

lists

I said what I meant as I thought the point lists returned were one form of
geometry and a VNF is another type of data representing geometry.  The
centroid() function which can operate on point lists and VNFs  is in a file
named geometry.scad.  But if the word geometry is technically reserved for
something else such as the output of rendering then thanks for the
correction and explanation.

On Mon, Nov 11, 2024 at 11:52 AM Adrian Mariano via Discuss <
discuss@lists.openscad.org> wrote:

I think maybe you meant to say that BOSL2 has functions that return point
lists and you can manipulate them with rotate, scale, union, difference
etc.  In addition, BOSL2 has centroid() which computes the centroid
(center of mass) of a polygon or polyhedron, which is not simply the
average of the vertices.  You can compute the average of the vertices---if
you want that value instead---with mean().

On Mon, Nov 11, 2024 at 12:43 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

Use the 2d shape functions from BOSL2 which return geometry and you can
manipulate it with their functions such as rotate, scale, union and
difference which return geometry.  BOSL2 also has functions such
as path_closest_point() which you might use to find corners and calculate a
center point.  The BOSL2 code can also provide a starting point to modify
into your own solutions when there isn't a routine in the library that can
do what you need.

On Mon, Nov 11, 2024 at 10:33 AM Sanjeev Prabhakar via Discuss <
discuss@lists.openscad.org> wrote:

oh I thought to make a polygon in openSCAD you have to define points
anyway.

Nevermind, I wrote a recursive function after a long time in openSCAD

On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss <
discuss@lists.openscad.org> wrote:

Issue IS that in openscad you dont have Access to the objects vertices
😞

.

Sanjeev Prabhakar via Discuss discuss@lists.openscad.org schrieb am
Mo., 11. Nov. 2024, 17:22:

Its long time since I have written any function in openSCAD, but this
should work

p0=[[2,0],[10,5],[5,10]];

function center_point(p,p1=[0,0,0],n=0)=
n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1);

echo(center_point(p0));

basically center of mass for any object would be
sum of all the points(2d or 3d coordinates)/ number of points

On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

Is there programmatic way to get the center (or any other reference,
such as a corner) point of a 2d object at an arbitrary position in the XY
plane?

Mark


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

> I think maybe you meant to say that BOSL2 has functions that return point lists I said what I meant as I thought the point lists returned were one form of geometry and a VNF is another type of data representing geometry. The centroid() function which can operate on point lists and VNFs is in a file named geometry.scad. But if the word geometry is technically reserved for something else such as the output of rendering then thanks for the correction and explanation. On Mon, Nov 11, 2024 at 11:52 AM Adrian Mariano via Discuss < discuss@lists.openscad.org> wrote: > I think maybe you meant to say that BOSL2 has functions that return point > lists and you can manipulate them with rotate, scale, union, difference > etc. In addition, BOSL2 has centroid() which computes the centroid > (center of mass) of a polygon or polyhedron, which is not simply the > average of the vertices. You can compute the average of the vertices---if > you want that value instead---with mean(). > > On Mon, Nov 11, 2024 at 12:43 PM Todd Allen via Discuss < > discuss@lists.openscad.org> wrote: > >> Use the 2d shape functions from BOSL2 which return geometry and you can >> manipulate it with their functions such as rotate, scale, union and >> difference which return geometry. BOSL2 also has functions such >> as path_closest_point() which you might use to find corners and calculate a >> center point. The BOSL2 code can also provide a starting point to modify >> into your own solutions when there isn't a routine in the library that can >> do what you need. >> >> On Mon, Nov 11, 2024 at 10:33 AM Sanjeev Prabhakar via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> oh I thought to make a polygon in openSCAD you have to define points >>> anyway. >>> >>> Nevermind, I wrote a recursive function after a long time in openSCAD >>> >>> On Mon, 11 Nov 2024 at 21:56, Guenther Sohler via Discuss < >>> discuss@lists.openscad.org> wrote: >>> >>>> Issue IS that in openscad you dont have Access to the objects vertices >>>> 😞 >>>> >>>> . >>>> >>>> Sanjeev Prabhakar via Discuss <discuss@lists.openscad.org> schrieb am >>>> Mo., 11. Nov. 2024, 17:22: >>>> >>>>> Its long time since I have written any function in openSCAD, but this >>>>> should work >>>>> >>>>> p0=[[2,0],[10,5],[5,10]]; >>>>> >>>>> function center_point(p,p1=[0,0,0],n=0)= >>>>> n==(len(p))?p1/len(p):center_point(p,p1+p[n],n+1); >>>>> >>>>> echo(center_point(p0)); >>>>> >>>>> basically center of mass for any object would be >>>>> sum of all the points(2d or 3d coordinates)/ number of points >>>>> >>>>> On Mon, 11 Nov 2024 at 21:16, Mark Erbaugh via Discuss < >>>>> discuss@lists.openscad.org> wrote: >>>>> >>>>>> Is there programmatic way to get the center (or any other reference, >>>>>> such as a corner) point of a 2d object at an arbitrary position in the XY >>>>>> plane? >>>>>> >>>>>> Mark >>>>>> _______________________________________________ >>>>>> OpenSCAD mailing list >>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>> >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Raymond West
Mon, Nov 11, 2024 6:37 PM

Without getting feedback from cursor position, I'm not sure how you
could define corners - 'top-left' wouldn't always work, for example. I
expect, if you could define the point you wanted to select, you could
just as easily calculate it in most cases. Openscad creates, it does not
deconstruct.

On 11/11/2024 15:46, Mark Erbaugh via Discuss wrote:

Is there programmatic way to get the center (or any other reference, such as a corner) point of a 2d object at an arbitrary position in the XY plane?

Mark


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Without getting feedback from cursor position, I'm not sure how you could define corners - 'top-left' wouldn't always work, for example. I expect, if you could define the point you wanted to select, you could just as easily calculate it in most cases. Openscad creates, it does not deconstruct. On 11/11/2024 15:46, Mark Erbaugh via Discuss wrote: > Is there programmatic way to get the center (or any other reference, such as a corner) point of a 2d object at an arbitrary position in the XY plane? > > Mark > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org