Defining a "point"

classic Classic list List threaded Threaded
9 messages Options
sb
Reply | Threaded
Open this post in threaded view
|

Defining a "point"

sb
Hello,
I have a simple question:
How do I define a "point" in Octave?
Is this like:
p1=(1,2)? or p1=point(1,2)? or something else?
I want to use them later for creating lines (passing between 2 defined
points).
How can I do that?

Thanks,
Shlomo



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

Doug Stewart-4


On Sat, Dec 28, 2019 at 8:47 AM sb <[hidden email]> wrote:
Hello,
I have a simple question:
How do I define a "point" in Octave?
Is this like:
p1=(1,2)? or p1=point(1,2)? or something else?
I want to use them later for creating lines (passing between 2 defined
points).
How can I do that?

Thanks,
Shlomo



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



points =[1 2; 7 1; 8 3]
plot(points)

--
DASCertificate for 206392



sb
Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

sb
Sorry but when I try your suggestion I get lines and not points (using
plot()).
Is there a point entity in Octave?
Like vectors, matrices?

Shlomo



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

siko1056
On 12/29/19 12:34 AM, sb wrote:
> Sorry but when I try your suggestion I get lines and not points (using
> plot()).
> Is there a point entity in Octave?
> Like vectors, matrices?
>
> Shlomo
>

Maybe a slightly modified version of Doug's example is what you want?

   points =[1 2; 7 1; 8 3]
   plot(points, "marker", "o", "linestyle", "none")

You should be more specific about your intentions, otherwise we just can
do wild guessing.  Type some pseudocode you wish Octave could execute,
for example.  Is it used just for plotting or do you plan some
computations on these points?

Other ideas are to create a struct with coordinates

   p1.x = 1
   p1.y = 2

or even a class would be possible

   classdef Point
     properties
     x
     y
     endproperties
   endclassdef

Whatever complexity you wish and need.

HTH,
Kai


sb
Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

sb
I thought my question was simple and clear:
I wanted to know if there is a "ready-to-use" object as "point"? and if yes,
how it is created/defined (the syntax)?
I understand from your answer, indirectly, that there is not (as you suggest
me to create it).
What I want to do is:
1/ To create 2 lines based on points (2 points for each of them) and draw
them
2/ To find the intersection point
3/ To draw the (intersection) point

Shlomo




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

Jose Ramom Flores das Seixas

Do you know the package geometry?

Às 19:00 de 28/12/19, sb escreveu:
I thought my question was simple and clear:
I wanted to know if there is a "ready-to-use" object as "point"? and if yes,
how it is created/defined (the syntax)?
I understand from your answer, indirectly, that there is not (as you suggest
me to create it).
What I want to do is:
1/ To create 2 lines based on points (2 points for each of them) and draw
them
2/ To find the intersection point
3/ To draw the (intersection) point 

Shlomo




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html




sb
Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

sb
Yes I installed. But couldn't find createPoint function (or other).
There are many functions beginning with create (such as createLine) but not
for points.
It seemed to me trivial but to my surprise I didn't find such an object.
I want to do simple things such as:
-Creating lines using 2 points (that I should retrieve them from an external
file).
-Finding intersections between lines (there is a function intersectLines in
the geometry package for this)
-Saving points in external files
-Drawing points
Etc...
So to be more precise, I want to:
Define 4 points, say, p1, p2, p3, p4 (in reality I will need much more
"couple" of points and they should be stored on an external data file
somehow)
Create 2 lines , say, L1 (between p1 and p2) and L2 (between p3 and p4)
Find the intersection point: p_intersect
Save all data in external txt file

Thanks
Shlomo





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

Juan Pablo Carbajal-2
> Yes I installed. But couldn't find createPoint function (or other).
Point is a 2x1 array, so it is just P = [x y]
There is no more complexity needed than this, and this is the
underlying abstraction for point in geometry and matgeom.
It gets a little bit more abstract for lines because there are several
way to define them (the same for circles, rays, etc...)
For polygons it gets back to a simple N-by-2 array, so there is no
createPolygon (there are some regular and special polygons though).

Regards


Reply | Threaded
Open this post in threaded view
|

Re: Defining a "point"

siko1056
On 12/29/19 4:00 AM, sb wrote:
> Yes I installed. But couldn't find createPoint function (or other).
> There are many functions beginning with create (such as createLine)
but not
> for points.
> It seemed to me trivial but to my surprise I didn't find such an object.
> I want to do simple things such as:
> -Creating lines using 2 points (that I should retrieve them from an
external
> file).
> -Finding intersections between lines (there is a function
intersectLines in

> the geometry package for this)
> -Saving points in external files
> -Drawing points
> Etc...
> So to be more precise, I want to:
> Define 4 points, say, p1, p2, p3, p4 (in reality I will need much more
> "couple" of points and they should be stored on an external data file
> somehow)
> Create 2 lines , say, L1 (between p1 and p2) and L2 (between p3 and p4)
> Find the intersection point: p_intersect
> Save all data in external txt file
>
> Thanks
> Shlomo
>

On 12/29/19 5:08 AM, Juan Pablo Carbajal wrote:

>> Yes I installed. But couldn't find createPoint function (or other).
> Point is a 2x1 array, so it is just P = [x y]
> There is no more complexity needed than this, and this is the
> underlying abstraction for point in geometry and matgeom.
> It gets a little bit more abstract for lines because there are several
> way to define them (the same for circles, rays, etc...)
> For polygons it gets back to a simple N-by-2 array, so there is no
> createPolygon (there are some regular and special polygons though).
>
> Regards
>


Shlomo, thanks for explaining your intentions.  The following example of
the geometry package should demonstrate how simple your task is to solve
using that package:

https://octave.sourceforge.io/geometry/function/intersectLines.html

HTH,
Kai