gnuastro-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[task #15578] Function to find if polygon vertices are sorted anti-clock


From: Mohammad Akhlaghi
Subject: [task #15578] Function to find if polygon vertices are sorted anti-clockwise
Date: Wed, 25 Mar 2020 13:35:40 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Follow-up Comment #9, task #15578 (project gnuastro):

Yes, this is the correct way to *put* an array into a `gal_data_t' container.
Just note that you aren't *converting* (copying the data into another
allocated space) when you use this method. 

Also, you don't need any special value to `minmapsize' because the first
argument is not NULL: its an already allocated array (`v'). `minmapsize' is
only relevant when you want this function to allocate memory. As a
place-holder you can just give it `-1' (largest `size_t' value).

Just note that the `ndim' argument of `gal_data_t' is the number of
dimensions, not the number of elements. So in this context, `ndim' should be
`1'. The number of elements (along each dimension) is set through the `dsize'
array (which you have set to NULL in the example!). Since the number of
elements is already in `n' and the dataset is one-dimensional (only needing a
one-elemnent array), you can simply give it a value of `&n'.

Just don't forget that when you define the permutation, keep the X and Y value
of each point to be touching.

After the permutation is done, nothing changes (`v' will still point to your
permuted array). But before freeing the `temp' with `gal_data_free', be sure
to set `temp->array=NULL', otherwise the allocated space will be freed.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/task/?15578>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]