1 Introduction

Many problems in Astrodynamics and Celestial Mechanics are constrained by the properties of their dynamical systems. As an example, the stability of an orbit is a dynamical property of the system which implies a constraint on problems such as designing orbits, transfer maneuvers, stationkeeping, or spacecraft disposal (Lam and Whiffen 2005; Scott and Spencer 2010; Lara et al. 2007; Villac 2008a; Nakhjiri and Villac 2011). Understanding these dynamical features leads to better designs and is essential in problems encountered in spaceflight mechanics.

Although phase space maps (e.g. stability maps) provide benefits to mission design, generating and analyzing them are often tedious. In general, mapping is defined as a transformation of a section of the phase space into a different vector space or a subset of the initial space. In some cases, an analytical function represent the mapped section. Obtaining embedded information from mathematical functions can be done using a variety of available tools in dynamical system theory and topology. However, this is not always the case, particularly when a complex feature of the phase space is considered. An example of this latter case is the chaoticity (or stability) maps. These maps project a section of the phase space into itself through the calculation of a stability indicator for a finite set of trajectories. This provides no analytic representation for the mapped section and it is usually difficult to extract the embedded information for further use of the map. This paper discusses new techniques to extract dynamical properties from this type of maps.

This paper addresses three problems associated with using dynamical maps (particularly, stability maps). The goal is to provide a functional representation of the dynamical features, such as stability, that can be used as a constraint function in other spaceflight mechanics problems.

The first challenge is to extract features from these maps autonomously (or with a minimal user interaction). A traditional approach to detect and extract stable regions is through manifold analysis (Howell et al. 2006, 2011; Lara and Scheeres 2002). Although this method shows promising results, stable and unstable manifolds are not always present in the map. As an alternative, we have explored image segmentation methods for their potential use in efficiently detecting and extracting regions of interest in precomputed dynamical maps. Image processing has had a major impact on applications in numerous fields, from medical imaging to surveillance and movie making (Szeliski 2010), but has not been sufficiently explored in Astrodynamics. Segmentation methods are based on the idea of logically grouping data into clusters. This can be applied to orbit datasets to help mission designers in selecting particular properties of interest, such as stability, out of a large set of precomputed trajectories. This approach results in detecting the boundaries of stability regions, allowing the user to automatically generate complex path constraints for trajectory optimization problems, such as the stable transfers problem (Nakhjiri and Villac 2011; Villac 2008a; Davis et al. 2010).

The second challenge that has been addressed in this paper is the functional representation of these features. Previous studies showed the lack of functional representation of the region and often rely on representation of the boundaries (Villac 2008b; Howell et al. 2006; Lara and Scheeres 2002; Sousa and Terra 2012). We have studied a discrete quadtree data structure that can capture the complex shape of the extracted regions from the maps. Discrete quadtree representations of the stability regions can be turned into functional continuous representation using basis functions such as B-splines or Gaussian mixtures.

The methods used in the previous two steps enable an efficient map generation algorithm based on data clustering techniques that decreases the number of integrations to compute a map. In particular, the grid of initial conditions underlying a map can be autonomously selected with higher resolution near the boundaries between the regions of different dynamical behavior, and less resolution where uniform dynamical behavior is expected. Efficient generation of these maps is needed to interactively explore the complex dynamics often encountered around small bodies and planetary moons.

The paper is organized in four main sections. Initially, a brief overview of the stability notion and the concept of the stable region is discussed to better illustrate the motivation and application of the paper. It also sets the notions that are used throughout the paper. The second section presents a survey of three clustering methods that are used to extract features from maps. This section is followed by the description of the representation techniques using a quadtree data structure. In the last section, based on the methodology discussed in both extraction and representation sections, a novel map generation algorithm is introduced.

2 Stable regions

The following section is a quick review of the stable transfers and stable regions to set the notation and introduce the terms we refer to in the next sections.

Stable transfers have been proposed as a transfer strategy to guarantee mission recovery under the risk of miss-thrust (in both magnitude and timing) (Villac 2008b). They consist of a sequence of impulses such that the transfer orbit stays within the boundary of a stable region at all times (and coasts along a family of stable periodic orbits). Such properties appear desirable for some missions such as close proximity to a small body which involves large uncertainties in dynamical model parameters. Phase space analysis of several dynamical systems encountered in spaceflight mechanics has shown the presence of connected regions of stable orbits immersed in regions of chaotic motion. Such regions are often associated with stable periodic or resonant orbits and are used as explanations of many phenomena in celestial mechanics, such as asteroid distributions in the main belt, planetary moons orbit resonance, or the formation of the solar system (see Fig. 1) (Mondelo et al. 2010; Villac and Liu 2009).

Fig. 1
figure 1

The stable region near Distant Retrograde Orbits (DRO) in the Jupiter–Europa system as shown in a stability map. Each trajectory is associated to a point on the map. The trajectories on the top are both stable and the trajectory on the left side of the map is unstable

When the initial stable periodic orbit lies inside a stable region, the boundary of the stable region in the velocity space determines the maximum size of the impulse \(\varDelta \mathbf{V}\) that results in a neighboring stable quasi-periodic orbit around the initial orbit as shown in Fig. 2. The maximum impulse imposes a condition on the transfer orbits and therefore can serve as a stability constraint in optimization problems (Nakhjiri and Villac 2011; Villac 2008a). Figure 2 illustrates a stable region in velocity space as well as the concept of the sequence of stable transfers. The size of each impulse (e.g. \(\varDelta \mathbf{V}_1\) and \(\varDelta \mathbf{V}_2\)) is constrained by the maximum \(\varDelta \mathbf{V}\) as shown on the stable region.

Fig. 2
figure 2

Sequence of stable transfers using the maximum \(\varDelta V\) determined by the size of the stable region in velocity space (Villac 2008b)

Chaoticity indicators, in general, distinguish the different behaviors of the dynamics by comparing the trend of change in the indicator value between regular and chaotic orbits. Figure 3 shows the difference between the propagation of Fast Lyapunov Indicator (FLI) (Froeschlé et al. 1997; Froeschlé and Lega 2009) value for a stable and an unstable orbit in the planar circular restricted three-body problem in the Jupiter–Europa system. The figure shows that the FLI value for a chaotic orbit grows much faster than a regular one. If the orbit is highly chaotic, the difference between these two trends grows faster. This pattern of FLI growth can be used to approximately distinguish chaotic orbits from regular ones over a finite time scale.

Fig. 3
figure 3

a Variation of FLI value for two trajectories in the Jupiter–Europa system with Jacobi constant of \(C=3.0\). b Corresponding FLI map (Villac 2008b)

The idea of a dynamical map thus consists of propagating a set of initial states in phase-space over a certain time and observe the change of their chaoticity indicator values. This can be visualized as an image capturing the stability properties of a region of phase space and is often referred to as a chaoticity or stability map. As mentioned before, mapping such dynamical properties provides a global overview of the system, allowing a down-selection of particular regions of interest. These maps can be separated into two regions where the dominant behavior of each region is associated either with chaotic or regular motions. The gradual growth of the indicator value on regular orbits (when compared to that of chaotic motions) can be used to detect the stable “island” inside the chaotic “sea” (Hénon 1969). To obtain the size of the stable region and its associated maximum impulse, \(\varDelta \mathbf{V}_{\max }\), the stable region should be detected on a given map. This process typically has to be performed many times during an optimization problem. Therefore, an efficient algorithm to automatically detect these regions with minimum user input is necessary.

3 Detecting stable regions

Detecting stable regions is often a complicated process since these regions often present much more irregular shapes that the triangular regions observed around Distant Retrograde Orbits (DRO) in the CR3BP. While the computation of stable and unstable manifolds can be used for the DRO example to capture the boundary of stable regions, this is not applicable in more complex dynamics as periodic solutions do not even exist (Villac 2008b; Howell et al. 2006). Additionally, as mentioned before, extracting these regions from dynamical maps often needs to be performed frequently and thus has to be done autonomously. A new approach based on clustering the points in dynamical maps using image processing segmentation methods is investigated in this research.

In image processing, detecting an object or a region in an image is referred to as segmentation. Image segmentation is the task of finding groups of pixels in an image that are homogeneous in some manner. This homogeneity is often based on a probabilistic model and statistical analysis of the properties of the points. In statistics, this problem is known as cluster analysis and has been widely studied (Jain and Dubes 1988; Szeliski 2010). In computer vision, this problem has been the center of attention for many years (Pavlidis 1977; Haralick and Shapiro 1985). Although these methods are usually applied to images, the statistical algorithms behind them are general and can be used to cluster other sorts of data. Most of these segmentation methods are also applicable to higher dimensional datasets. The advanced development of these methods in computer vision makes them an excellent choice for region detection on stability maps (or similar problems in astrodynamics).

Figure 4 shows two sample maps that are used throughout this paper to test the segmentation algorithms. Both maps represent the FLI values generated in the Restricted Three-Body Dynamics. The FLI map near Europa shows a distinct and regular triangle shaped stable region inside a highly chaotic background, while the FLI map near the asteroid 6489 Golevka has an irregular shaped region where the boundary of the stable region is not clear and many impact orbits are present in the map (Villac 2008b, 2007). The time scale of generating the first map is also much larger than the second one. This is intentionally selected to show that the segmentation methods work on early stage FLI maps where the difference in indicator values between stable and unstable regions is not too large.

Fig. 4
figure 4

a FLI map around a distant retrograde orbit near Europa using CR3BP. b FLI map of asteroid 6489 Golevka using elliptic restricted three-body dynamics

3.1 Segmentation algorithms

Out of various segmentation methods available in image processing, three methods are investigated in this research for their relevance to the dynamical features of stable regions. These methods are: k-means clustering, contrast gradient segmentation, and texture segmentation based on entropy. These are commonly used in image processing and furthermore, are the basis of more complex segmentation methods (Szeliski 2010). Therefore, they provide a good basis to investigate the potential use for spaceflight mechanics. To demonstrate the methods, they have been applied to two FLI maps already displayed in Fig. 4 and the results obtained are discussed in the following subsections.

3.1.1 K-means clustering

This method is one of the most common clustering methods in image processing problems. The relevance of this method to chaoticity maps lies in the actual difference of indicator values between stable and chaotic regions. For an image, each pixel has a set of data (for example, the FLI value in the case of chaoticity maps) that can be gathered in a large data vector for all the pixels. In general, given a set of data or observations \((\mathbf{x}_1,\mathbf{x}_2,\ldots ,\mathbf{x}_n)\) where each observation can be a N-dimensional data vector, k-means clustering partitions the n observations into k sets \(\mathbf{S}=(S_1,S_2,\ldots ,S_k)\) such that it minimizes the within-cluster sum of squares:

$$\begin{aligned} \underset{\mathbf{S}}{\text {argmin}} \sum _{i=1}^{k} \sum _{\mathbf{x}_j \in S_i} \left| \mathbf{x}_j - \mathbf{\mu }_i \right| ^2 \end{aligned}$$

where \(\mathbf{\mu }_i\) is the mean of data in \(S_i\). The algorithm can be initialized by randomly sampling k centers from the initial observations. It, then, iteratively updates the center of the clusters based on the samples near the center value [see Ref. Szeliski (2010) for more details]. Figure 5 shows the concept of the k-means clustering when the observations are based on the location of each point.

Fig. 5
figure 5

Sample k-means clustering method demonstration on the location of a set of random points

The indicator values in a chaoticity map are usually generated in a normalized scale and can be used directly in a k-means clustering algorithm. While the k-means algorithm can be applied to any set of data, when applied to an image, the clustering can be done based on the color of the pixels. For chaoticity maps, the color reflects the value of the indicator and, naturally, creates a distinction between stable regions and the rest of the map. The result of the method is independent of the choice of the colormap as long as a normalized color space is selected. The k-means clustering can be applied to the color of the pixels in the cases when the indicator values are not available or a non-normalized scale has been used in generating these values. If applied to an FLI map, the k-means algorithm returns k clusters with k center FLI values (or center color if applied to a colormap). Each cluster contains all the pixels with the FLI value close to its mean (or center). The difference between each pixel to the center value is calculated by the Euclidean distance metric of their values.

Fig. 6
figure 6

K-means clustering on the sample maps with two clusters. a Identifying the clusters, each cluster is assigned a color, b binary selection of the stable clusters after removing false-detections

Although the immediate intuition is to segment the map into two distinct regions (regular vs. chaotic), it does not dictate the value of k to be 2. Generally, more clusters can be used to clearly differentiate the stable region from the escape trajectories and the boundary of the stable region where the indicator values are closer to the stable orbits compared to the orbits in the chaotic region. In Fig. 6, dispersed small regions have been detected as part of the stable region in the asteroid map. However, these regions have been assigned to a separate cluster in Fig. 7 where the number of clusters has been increased. In most cases, 3 or 4 clusters are sufficient to capture the stable region clearly.

Fig. 7
figure 7

K-means clustering on the sample maps with three clusters. a Identifying the clusters, each cluster is assigned a color, b binary selection of the stable clusters after removing false-detections

Note that in the asteroid map, a large segment of escape trajectories are detected to be stable. To remove this region, we made the assumption that any region that intersects the boundary of the map in more than two sides, is a false detection and has to be filtered out of the final result.

Fig. 8
figure 8

Contrast gradient segmentation on the sample maps. a Gradient change maps, b binary selection of the stable clusters

3.1.2 Contrast segmentation

The second segmentation method considered is based on edge detection and the basic morphology of an image. In chaoticity maps, these edges represent the boundary of stable regions where the gradient of the FLI value is largest compared to any other region in the map. The method inspects the directional gradient of the data (pixel color or FLI value) and then, detects the edges of the objects (e.g. a stable region) by finding the maxima of the gradient magnitude in a direction perpendicular to the edge orientation. This can be done using a convolution filter using matrix convolutions. The filter replaces the value of each pixel by a weighted average of its neighboring pixels. A low-pass (low-frequency) filter strongly weights the neighboring values while a high-pass (high-frequency) filter uses a negative weight coefficients to emphasize on the finer details and changes. Derivation is an example of a high-pass filter. Unfortunately, taking derivative of an image amplifies noise, since the noise to signal ratio is larger for high frequency filters such as derivation. To avoid these high frequency noises in the filter, most edge detection algorithms smooth the image with a low-pass filter prior to applying the gradient filter. The smoothing filter should be independent of the orientation since the detection of the edge depends on the direction of the gradient. Usually a circular symmetric Gaussian filter is used to smooth the image (as is applied here). A Gaussian filter is a convolution filter that has a Gaussian weight coefficient for the neighboring pixels. After applying the first Gaussian filter, a second gradient is applied to the image to find the maxima of the gradient values of the filtered image. The combination of these filters is known as “Laplacian of Gaussian” (LoG) kernel (Marr and Hildreth 1980; Szeliski 2010).

Although the method detects all the edges, finding closed boundaries inside the map can efficiently reduce the number of the segments to only a few regions. This method works best for high contrast objects when one region has a large contrast difference with its background region. This is not always the case in stability maps specially in the early stages when the stable region is not clearly distinguishable in the map. The result of this segmentation is illustrated in Fig. 8 for the selected maps. The contrast filter separates the image from the boundaries with the highest change in the gradient value. The areas where the gradient change occurs more frequently are then removed. Due to the dynamics, it is expected that the region containing the minimum gradient change should be the stable region. However, as illustrated in the asteroid map, sometimes other regions show the same property under this filter. These false regions can be removed when the result of another image segmentation method is also available, which is discussed in the next sections. Compared to the k-means clustering, the results present smoother boundaries, which can be desirable for optimization problems.

3.1.3 Texture segmentation

The last segmentation method considered is relevant to chaoticity maps through the notion of “disorder”. The nature of chaotic regions is associated with highly disordered motions in any neighborhood as opposed to stable regions where the randomness in the values of the indicator is significantly lower. Texture segmentation investigates the notion of disorder in a map and finds regions with similar textures. An image texture can be defined as a quantitative measure of the arrangement of pixel values in a region. More precisely, the disorder is measured by an entropy function providing a notion of randomness between neighboring pixels in a region. This randomness can be measured based on the FLI values in the chaoticity map. Assume that \(I(\mathbf{x}) \in \mathbf{[0~,~1]}\) is the normalized FLI value calculated at \(\mathbf x\). For a neighborhood \({\mathcal {N}}\) defined around \(\mathbf{x}_0\), the probability density function \(P_{{\mathcal {N}}}\) is the probability of a region having FLI value \(\alpha \in \mathbf{[0~,~1]}\):

$$\begin{aligned} P_{{\mathcal {N}}} = \frac{1}{n} \sum _{i=1}^n \delta \left( \alpha - I(\mathbf{x}_i)\right) \end{aligned}$$

where \(\delta \) is the Dirac’s delta function and n is the number of neighboring points in \({\mathcal {N}}\). Given a probability distribution P for a set of N neighborhoods in a region \({\mathcal {R}}\), the associated entropy \(S_{{\mathcal {R}}}\) is defined as:

$$\begin{aligned} S_{{\mathcal {R}}} = \frac{1}{N} \sum _{i=1}^N P_i \cdot \log {P_i} \end{aligned}$$

The method is initialized by defining the initial neighborhoods as a uniform grid of regions of the same size on the map (for example, a grid of p-by-p pixel squares for an image). By calculating the entropy for all these initial regions, the algorithm then merges the neighborhoods where the total entropy of the new region either remains constant or decreases. On the other hand, if merging two regions leads to an increase in total entropy, the algorithm does not combine the neighborhoods. The increase in entropy can be visualized as crossing the border of a region with a different texture which results in more randomness in the data distribution. This merging continues until all regions with similar texture have been clustered and merged. Note that to apply this method, presence of at least two regions with different textures in the image is needed.

In stability maps, the chaotic region shows a very different texture compared to the stable region due to the homogeneity of the FLI values inside the stable region. A region with no texture or a minimum entropy is considered a minimum disorder and it can be extracted as the stable region. The result of applying the texture filter on the sample maps is illustrated in Fig. 9.

Fig. 9
figure 9

Texture filter segmentation on the sample maps. a entropy clustering maps, b binary selection of the minimum entropy region

Among all these segmentation methods, the result of the texture analysis appears as the smoothest. It also has an acceptable distance from the boundary of the stable region which may be desirable in optimizing stable transfers due to the safety factor it provides. Additionally, this smooth region better captures the longer time propagation of the stable region since longer integration often appears as smoothing the boundary of the region. On the other hand, applying this segmentation requires prior information about the map that specifies the minimum and maximum size of the stable regions. Otherwise, many small regions will be detected. A combination of all these three methods can eliminate the necessity of prior knowledge.

3.2 Combining segmentation algorithms

To allow the user to tailor the segmentation to the specific requirements of a problem, a combination of all these methods can be used to provide better control over the output. As discussed in the previous section, a texture filter provides a smoother (but more conservative) border which can be used for representations. Meanwhile, the K-means filter detects the stable region with more restriction on the actual FLI value than having smooth boundaries. A trade-off between these extremes seems desirable and combinations of these segmentation method can achieve such a task. The combination can be done through a variety of strategies. In this section, a simple probabilistic approach is used to combine the results of the previously discussed segmentation methods.

The probability of being stable or unstable is defined by the distance of the pixel to the detected stable region (see Fig. 10).

$$\begin{aligned} P(\mathbf{x}) = \frac{\text {distance of point }\mathbf{x} \text { to the closest stable point}}{\text {maximum distance metric in the map}} \end{aligned}$$
(1)

The result of any set of segmentation methods can be linearly combined as:

$$\begin{aligned} P(\mathbf{x}) = \sum w_i P_i(\mathbf{x}), \quad \sum w_i =1 \end{aligned}$$

where \(w_i\) is the weight of the ith map with the probability \(P_i\). Then, based on the value of a threshold, \(\gamma \), a new binary map of stable/unstable regions can be generated.

$$\begin{aligned} B(\mathbf{x}) = \left\{ \begin{array}{ll} 1\quad &{} \forall \mathbf{x}: P(\mathbf{x}) \ge \gamma \\ 0\quad &{} \forall \mathbf{x}: P(\mathbf{x}) < \gamma \end{array}\right. \end{aligned}$$
Fig. 10
figure 10

Creating a probability map from a binary map based on the distance of each point to the stable regions

By selecting different weight coefficients and thresholds, different results are obtained. Figure 11 shows the effect of adding the probability threshold on the texture segmentation filter.

Fig. 11
figure 11

The effect of changing probability threshold \(\gamma \) in texture segmentation method (the weight coefficient for texture segmentation is 1). a \(\gamma = 1\). b \(\gamma = 0.99\). c \(\gamma = 0.98\)

This gives the user the control on how loosely the stable region is desired. For example, to include more points from the boundary of the stable region, a lower value of \(\gamma \) can be used. Note that the shape of the region is highly sensitive to small changes in the threshold value. Figure 12 shows the effect of having different weight coefficients to combine the segmentation. The weight coefficient \(w_1\), \(w_2\), and \(w_3\) correspond to the weight of k-means, contrast segmentation, and texture segmentation methods.

Fig. 12
figure 12

Combined segmentation with different weight coefficients. The threshold is 0.99 for all these cases. a \(w_1=\frac{1}{2}\), \(w_2=\frac{1}{2}\), \(w_3=0\). b \(w_1=0\), \(w_2=\frac{1}{2}\), \(w_3=\frac{1}{2}\). c \(w_1=\frac{1}{2}\), \(w_2=0\), \(w_3=\frac{1}{2}\). d \(w_1=\frac{1}{3}\), \(w_2=0\), \(w_3=\frac{2}{3}\). e \(w_1=\frac{2}{3}\), \(w_2=0\), \(w_3=\frac{1}{3}\). f \(w_1=w_2=w_3=\frac{1}{3}\)

The difference in the final segmentations can be viewed in the result. For example, having a larger weight for the texture segmentation method produces a smoother and more conservative boundary. More importantly, since some methods require user input for initialization (e.g. texture segmentation), adding weight to other methods can eliminate the necessity of prior information in most cases. Combination also reduces false detections in some maps. Note that the probability function in Eq. (1) is only an example of defining a probability map from the binary images and demonstrates possibility of combining these methods.

4 Representation of stable regions

The segmented region obtained from the previously discussed methods generates a binary pixel map where the stable and unstable regions are indicated by true and false values. To use these results in applications (such as optimization problems), a functional representation would be beneficial. The representation function should return the stability “situation” of the orbit for any given state x:

$$\begin{aligned} R(x) = \left\{ \begin{array}{ll} 1 &{} \quad \text {if } x \text { is inside the stable region}\\ 0 &{} \quad \text {if } x \text { is outside the stable region} \end{array}\right. \end{aligned}$$

Either discrete or continuous (smooth) functions can be used to represent detected regions. A continuous (smooth) representation can be obtained based on a discrete representation of a map and is discussed later. Discrete representations have several benefits when the derivatives of the representation are not required. The efficiency in searching the map or stacking many maps as a database is a useful property of such representations. In computer science, binary space partitioning is a general method for recursively dividing a space into compact sets. This generates tree data structures that represent the space in a binary format and are often known as binary space trees. Each set at the end of recursion (leaves of the tree), represents a cluster of data which satisfy one or more homogeneity conditions. In this paper, a well-known quadtree structure is used for data clustering to represent the detected stable region on a binary map.

Fig. 13
figure 13

Tree structure in quadtree clustering; Each node has exactly four children

Fig. 14
figure 14

The quadtree representation of the stable region on the sample maps

A quadtree is a tree data structure in which each node has exactly four children (Fig. 13). Quadtrees are often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions. The algorithm divides a block and checks a homogeneity condition for all points inside each quadrant. If the condition does not hold for a quadrant, the algorithm continues dividing that region. Otherwise, the block and a single value representing it are saved in a tree structure. A simple homogeneity condition can be defined based on the difference between the maximum and minimum value in a block with respect to a given threshold. For example, the following condition can be used to determine the homogenous nodes:

$$\begin{aligned} \max (\mathbf{x}_j) - \min (\mathbf{x}_j) \le \lambda , \quad \forall \mathbf{x}_j \in \mathcal {T}_i \end{aligned}$$

where \(\mathcal {T}\) is a tree structure and \(\mathcal {T}_i\) is the ith node of the tree. \(\mathbf{x}_j\)’s are state vectors and since the tree is spanning the whole phase space, each point belongs to at least one node of the tree. The threshold parameter, \(\lambda \), is an arbitrary threshold and can be selected according to the problem requirements. In the case of binary maps, the threshold is simply zero.

At the end of the recursive process, for each block, a value and the location of the block in the tree structure are stored. Figure 14 shows the block structures for the sample maps. Note that the points on the upper and left borders of each block belong to the block.

Similar higher order structures exist such as octree in 3-dimension data sets. Other algorithms such as “K-d tree” also exist which have some benefits over quadtree in terms of searching performance. However, quadtree has advantages which are more relevant to the maps. A quadtree is more efficient for a variable resolution representation of a data field. Additionally, the quadtree algorithm produces constant aspect ratio cells that simplifies tracking the phase space inside a map. In K-d tree, there is no control on the aspect ratio of the cells. In general, a K-d tree is more efficient for higher dimensional datasets and quadtree is a better choice for low dimension data structures and is considered here.

As mentioned earlier, one of the benefits of having tree structures is the efficient search algorithm that can be performed to identify the stability or instability of any points in the maps. For optimization problems, many of these maps are required and it is convenient to precompute the stability maps for the whole range of energy and stack them together. Storing all these maps and then performing a search over them requires an enhanced storing algorithm. In this quadtree database, points inside each block have the same value. Therefore only one value should be saved. This sparse-like storing is the minimum information required for a map.

From the discrete representation, several strategies can be used to add smoothness to the representation function. Each node of the quadtree can be represented by a set of basis functions. A combination of all these sets can generate the functional representation of the discrete maps. Two often practical examples of global basis functions are Gaussian mixtures and B-splines. The detail of using these basis function to represent N-dimensional regions can be found in Colombi et al. (2009) and Bale et al. (2002).

The performance of representing and searching through the tree structures shows a potential for using similar ideas for generating a phase space map. When storing a map in a quadtree structure requires far less points that have been used to generate it, some reductions in the generation process itself can be possible. This idea is explored in the next section.

5 Map generation using data clustering

As shown in the previous section, clustering the points in a map results in efficient representations of the map. For example in the case of stability maps, instead of having a uniform grid of points for a map, it is more effective to have a denser grid near the boundaries of the stable regions and fewer points inside and outside of the stable regions. The question, then, is to determine how to define these nonuniform grids. Based on the clustering algorithms in the previous sections, an algorithm to create this nonuniform grid based is discussed in this section.

The map generating method presented in this paper is not restricted to stability maps and can be used to generate any dynamical map. Thus, a general problem of map generation using clustering techniques is presented in the next section. That follows by the demonstration of the method for systems with 2 degrees of freedom in the case of a stability map. Then, the general method is studied in N dimensions and an example of a 3-dimensional map is presented.

5.1 Map generation and clustering

In this section a formulation of a generating map problem in a general case using the clustering techniques is presented. The problem is to propagate a section of the phase space while capturing some properties of the system. The process of map generation is identified by two main elements. The first element of a dynamical map is the characteristics that it represents. This is generally represented by a functional for a set of trajectories. A functional is a correspondence which assigns a definite (real) number to each function (or curve) belonging to a class (Gelfand and Fomin 2000). Examples of two different forms of functionals are presented in Eqs. (2) and (3):

$$\begin{aligned} I({\mathbf {x}}(t_0),T,t_0)=\int _{t_0}^t f(\varphi ({\mathbf {x}}(t_0),t,t_0))dt, \quad I:\varphi ({\mathbb {R}}^6,{\mathbb {R}}) \rightarrow {\mathbb {R}}^N \end{aligned}$$
(2)

or

$$\begin{aligned} I({\mathbf {x}}(t_0),T,t_0)=\sup _{t_0 \le t\le T} f(\varphi ({\mathbf {x}}(t_0),t,t_0)) \end{aligned}$$
(3)

where \(f(\varphi ({\mathbf {x}}(t_0),t,t_0))\) is a function of the state of a dynamical system with flow, \(\varphi \), and \(I({\mathbf {x}}(t_0),T,t_0)\) is the functional. This functional can be a stability indicator, a notion of the uncertainty, or any other deterministic or stochastic property of an orbit. A dynamical map is a global visualization of this functional on a section of the phase space.

The second element of a dynamical map is the section of the phase space that it represents. In this section, it is shown that using clustering can provide an automated dynamical grid generation for maps. This results in eliminating the need for an initial grid of points for the integration. The clustering algorithm used to generate maps is an iterative process that creates the grid adaptively based on the progress of the map generating algorithm. Discrete clustering algorithms (particularly, tree structures) have been considered in this research. Although the quadtree clustering has been discussed in this research, any logical tree structure can be used as long as a consistent homogeneity condition can be defined for dividing the nodes of the tree. The homogeneity condition determines the end nodesFootnote 1 of the tree and more generally, it determines the number of children for each node (although, in this research, only trees with a fixed number of children per node are considered). The homogeneity function \(h(\mathbf{x})\) should measure a property of the node, \(\mathbf{x}\), inside the tree. The homogeneity condition that we use for the map generating process can be represented as:

$$\begin{aligned}&| h(\mathbf{x}^*) - h(\mathbf{x}) | <\lambda , \quad \forall \mathbf{x} \in {\mathcal {N}(\mathbf{x}^*)} \\&\quad \mathbf{x^*},\mathbf{x} \in \mathcal {T} \end{aligned}$$

where \(\lambda \) is a threshold, \(\mathcal {T}\) is the tree, and \(\mathcal {N}(\mathbf{x^*})\) is the set of spatial neighbors of \(\mathbf{x^*}\).Footnote 2 Note that not all the neighboring blocks of \(\mathbf{x^*}\) belong to the same level of the tree structure. If the condition is satisfied, \(\mathbf{x}^*\) needs no children (i.e. is an end node or a leaf of the tree). The example of using this form of homogeneity condition is provided in the next section.

By defining a functional, a tree structure, and a homogeneity condition, the map generation process can be initiated after selecting a range of phase space and a desired resolution for the final map (which determines the depth of the tree structure).Footnote 3 This process is explained in the next section for a case of a 2-dimensional stability map.

5.2 Generating maps in 2 dimensions

In this section, generating the map for a case of a 2-degree of freedom system is presented to better illustrate the relation of the method to what we have already discussed in previous sections. The goal is to regenerate the sample maps used previously for detection and representation methods, with no prior information. This requires some stability analysis of the system and FLI has been used to be consistent with the results of previous sections.

Using quadtree for generating the maps is similar to the process of representation. The main difference is that in representing regions, the information about the stability of the points in the map is known. In contrast, in the case of generating maps, there is no prior information about the map. Therefore, the information is generated alongside the dividing algorithm of the quadtree.

The map generation starts from a low resolution grid of a few points, each representing the center of a rectangular region (i.e. a block). These blocks form the initial level of the quadtree structure of the map. Chaoticity indicators for these points are calculated and based on the value of these indicators, it can be decided which points are stable.Footnote 4 It is likely that at low resolution, all blocks are either stable or unstable. The initialization step recursively continues this process of dividing the region until the map is no longer uniform and contains both stable and unstable regions. The algorithm then proceeds to the main loop and starts checking the values of the neighboring blocks for each block of the map. If there is a difference between any neighbor and the block, the algorithm tags both. The search through the values continues until all blocks that have to be divided in the next level are identified. In the next step, the algorithm divides all the tagged blocks. Note that if the blocks are from different levels of the tree structure, the algorithm redivides those blocks until they reach the same level. New chaoticity values are calculated for the new blocks and the loop continues until the algorithm reaches a certain resolution limit. The resolution limit determines the size of the smallest blocks in the map. Figure 15 illustrates a diagram of this algorithm.

Fig. 15
figure 15

The algorithm of map generation, showing initialization and main iterations

Figure 16 shows a simple example of the sequence of dividing a map to illustrate the algorithm. In each step, a function determines whether the block is stable or not using the coordinate of the center of the block. The stable blocks are shown in black while the unstable blocks are in white.

Fig. 16
figure 16

A schematic map generation, showing the process of subdividing the blocks at each step

The map generation algorithm has been used to regenerate the samples map used in the segmentation and representation sections. The map generation results are shown in Fig. 17.

Visual comparison shows the success of the method to generate the stability maps in both cases. Comparing the tree structure in the map generation to the ones in the representation section (Fig. 14), indicates that more blocks are required to generate the same map. These additional blocks are the penalty paid for having no prior information about the maps in the generation algorithm, whereas in the case of representation, the full map is already available. However, the number of FLI values generated for these maps are significantly lower compared to the same resolution maps generated using a uniform grid.

Fig. 17
figure 17

The result of the map generation algorithm in recreating the sample maps

Two numbers reflect the achievement of the method. The first number is the final number of blocks creating the maps. The second number is the exact number of times that the FLI function is called in the process of generating these maps which is different from the first number (and always larger). The comparison is done between the number of the FLI values required for a uniform grid and the number of FLI values for the same resolution map generated based on clustering. For example, for a map with a resolution of 256, the number of FLI calls for a uniform grid is \(256 \times 256\) which is equal to 65,536 calls to the function that returns the FLI value for the trajectory. Tables 1 and 2 show the summary of these comparisons for both sample maps.

Table 1 The number of blocks and FLI calls for generating maps in different resolutions for the stable region in Europa-Jupiter system, sample map 1
Table 2 The number of blocks and FLI calls for generating maps in different resolutions for the stable region of asteroid 6489 Golevka, sample map 2

The increase in resolution shows even more improvement in the performance of the method since the number of points in large clusters increases in the uniform grid and it remains the same in the tree-based map generation. For example, in generating the map for asteroid Golevka, on a map with \(512\times 512\) FLI calls in a uniform grid, this method only requires \(<\)4 % of these FLI values to generate the same map. The significant improvement shows the potential use of this method for the purpose of generating chaoticity maps in general. In general, for using these maps in optimization problems, higher dimension maps are required. Generating N-dimensional maps is discussed in the next subsection.

5.3 Generating maps in N dimensions

Most of the problems encountered in astrodynamics have dimensions larger than 2. Therefore, generating maps for dynamical properties of those systems often requires propagating large state vectors for each trajectory. This results in an N-dimensional map for a system with N degrees of freedom. For example, in the optimization problem of stable transfers in planar case, a change in the energy results in a change in the shape and the location of the stable region. Thus, a 3-dimensional map is required to fully represent the constraint function for the stable region. This section demonstrates the use of the clustering method explained in the representation section for N-dimensional map generation.

The main difference in the algorithm compared to the 2-D cases is in the indexing of each node in the tree structure. For example, in a 3-D case, an octree replaces the quadtree algorithm and divides each block into 8 sub-blocks. Since it is still a tree structure, the same algorithm can be used with only increasing the number of children for each node. Checking the homogeneity condition in the N-D case remains the same with only some changes due to the increase in the number of the neighbors for each block. Figure 18 demonstrates the schematic structure of an N-D generalized quadtree.

Fig. 18
figure 18

Generalized quadtree structure for N-dimensional datasets. Each node has exactly \(2^N\) children

Since the visualization of maps with \(N > 3\) is impractical, a case of a 3-degree of freedom system is selected for demonstration purpose in this section. The case studied is the stable region for DRO near Europa in the planar case for different energies. The governing equations of motion are from the planar Hill’s three-body problem, which is originally a 4-dimensional problem. The shape of the stable region changes due to the change in energy (or Jacobi constant) which is also an integral of motion. The map generation can be considered on a Poincaré section by fixing the y coordinate at \(y=0\). Also, by using the Jacobi value to compute the velocity in the y direction, the problem then becomes a 3-degrees of freedom with respect to x, \(v_x\), and C, where C is the value of the Jacobi integral. The result of using the map generation method for this sample problem is shown in Fig. 19 for a resolution of \(128 \times 128 \times 128\) points. This resolution corresponds to 205 km in position, 12 m/s in velocity, and \(3 \times 10^{-5}\) in the normalized Jacobi constant value. The graph in Fig. 19 shows the stable region for DRO for different values of energy. It is important to point out that this is a functional representation of the region which is visualized in an image. A smooth representation can also be obtained using a proper set of 3-dimensional basis functions as discussed previously.

Fig. 19
figure 19

Stable region for different energies. This shows a 3-D stable region representation for DRO near Europa. The color gradient indicates different levels of energy (or Jacobi constant)

With a uniform grid map, generating the same stable region with the same resolution, 2,097,152 calls to FLI function are required. In comparison, the map generated using clustering (Fig. 19) only uses 671,088 calls to the FLI function which is about 68 % saving on the amount of computations. The number of blocks representing the final map is 449,680, which is lower compared to saving all the points from the uniform grid. In addition to the minimum effort required for transferring the 2-D algorithms to N-dimensional cases, the results prove the efficiency of using clustering for generating high dimensional maps. Although an octree showed a considerable enhancement in generating and representing this sample map, it should be noted that having this many children for each node of the tree in higher dimensional maps may not be necessary. Thus, further work is needed to explore other tree structures.

6 Conclusion

We applied image processing and clustering analysis techniques to extract complex dynamical constraints and detect complex regions inside dynamical maps. Using clustering analysis is not the obvious choice for detecting these regions in spaceflight mechanics. However, it led to developing efficient map generation techniques at the end.

The discrete tree structure we used for representation of the regions inside maps provides efficient search algorithms to obtain the stability of a trajectory inside a phase space map. The quadtree structure showed the compactness ratio of 0.01 for representing the sample maps. This can benefit storing and searching large datasets of trajectories. The functional representations (using B-spline functions and Gaussian mixtures) can be directly used in other problems such as optimizations as a constraint function.

The last part of this paper demonstrated the use of clustering algorithms to adaptively generate maps more efficiently resulting in significant reductions in the computations associated with the map generation process. The benefits of using clustering in the generation of maps can be summarized as follows:

  • The generated map already has a quadtree structure for the regions inside the phase space which can be used directly in other problems (e.g. as a constraint function in an optimization problem).

  • Compared to a uniform grid map, clustering algorithms achieve the same resolution maps by using a smaller set of points. For example, for one of the sample maps in this paper, the map is generated based on \(<\)4 % of the points required for a uniform grid map. This is caused by the nonuniform grid which is adaptively created in the process of generating maps using clustering techniques.

  • The map generation can be initiated with no prior knowledge of the location of the desired regions and effectively creates a denser grid of points in the neighborhood of the boundaries of the desired regions.

  • The resolution of the map can be easily refined without having to generate the map all over again. This is the result of the effective representation of tree structures.

  • The map generation algorithm can be applied to N-dimensional sections with minor modifications to the 2-dimensional algorithm.

Future work of this topic includes further study of other image processing methods to optimize the clustering of the trajectories on any section of phase space. Additionally, investigating other tree structures such as the K-d tree can improve the representation of high dimensional maps.

An automated and efficient map generation technique offers promising performance for interactive map generation algorithms and improves the process of preliminary space mission design.