top of page

Support Group

Public·16 members


A variable in a lambda expression has the same name as a variable previously defined within the same scope. This can be a variable in an enclosing block of code for a nested lambda expression, a range variable previously defined within a LINQ query, or a variable that is implicitly declared for a LINQ query.


Indeed, you can change the enclosing environment. It is the enclosing environment of a function from a package you cannot change. In that case you don't change the enclosing environment, you actually create a copy in the new environment:

In this case, the second sd has the global environment as the enclosing and binding environment, but the original sd is still found inside the package environment, and its enclosing environment is still the namespace of that package

What happens here? The enclosing environment is still the namespace ''stats''. That's where the function is created. However, the binding environment is now the global environment. That's where the name "f" is bound to the object.

The enclosing environment of e is the global environment. So f still works as if its enclosure was the global environment. The environment e is enclosed in it, so if something isn't found in e, the function looks in the global environment and so on.

Now suppose you make an environment with the empty environment as a parent. If you use this as an enclosing environment for a function, nothing works any longer. Because now you circumvent all the package environments, so you can't find a single function any more.

This is where it gets interesting. The parent frame or calling environment, is the environment where the values passed as arguments are looked up. But that parent frame can be the local environment of another function. In this case R looks first in that local environment of that other function, and then in the enclosing environment of the calling function, and so all the way up to the global environment, the environments of the attached packages until it reaches the empty environment. That's where the "object not found" bug sleeps.

environment(function) gives the function's enclosing environment (i.e. the closure) which is assigned a pointer to the environment in which the function was defined. This convention is called lexical scoping, and is what lets you use patterns like factory functions. Here is a simple example

The above factory function illustrates the link between the function and it's enclosing environment via continuation of the search for a variable (and use of the scoping assignment operator, whereas the following illustrates the link between a local environment and the calling frame via Promises which is how R passes variables in a function call.

A lot of standard books(eg. Effective Java) and reference material refer to enclosing instances and enclosing scopes when discussing inner classes. This has been discussed in other questions as well No Enclosing instance error and Anonymous classes enclosing instances too.

A static member variable/method of a class is shared by all instances of the class, thus directly accessible by the class name. In a similar way a static nested class, can be thought of being independent of any instance, thus not requiring the enclosing instance to construct.

Is there a good way to prevent this kind of thing happening? I could imagine touching something that was declared private in the enclosing class, but that would be forcing me to write extra code (as my current design doesn't contain any inherent private members, all is public).

Enclosure or Inclosure[a] is a term, used in English landownership, that refers to the appropriation of "waste"[b] or "common land"[c] enclosing it and by doing so depriving commoners of their rights of access and privilege. Agreements to enclose land could be either through a formal or informal process.[3] The process could normally be accomplished in three ways. First there was the creation of "closes",[d] taken out of larger common fields by their owners.[e] Secondly, there was enclosure by proprietors, owners who acted together, usually small farmers or squires, leading to the enclosure of whole parishes. Finally there were enclosures by Acts of Parliament.[5]

I'm using OpenRoads Designer Release 2 (the one that came out in 2021). When I try to use the Create Region tool, an error comes up that says "no enclosing region found." I've checked over and over, but I can't find a break in the lines. I tried creating a square that I know has no line breaks and testing the Create Region tool in there. It worked the first time, but it won't work anymore. Is there a step I'm missing? Right now I'm clicking on the Create Region tool and right clicking inside the shape I want to fill. Can anyone help me?

An algorithm which computes the minimum area triangle enclosing a convex polygon in linear time already exists in the literature. The paper describing the algorithm also proves that the provided solution is optimal and a lower complexity sequential algorithm cannot exist. However, only a high-level description of the algorithm was provided, making the implementation difficult to reproduce. The present note aims to contribute to the field by providing a detailed description of the algorithm which is easy to implement and reproduce, and a benchmark comprising 10,000 variable sized, randomly generated convex polygons for illustrating the linearity of the algorithm.

The problem addressed by this note is to find the triangle of minimum area enclosing a convex polygon in the Euclidean plane \(E^2\). Similarly, the problem of finding the triangle of minimum area enclosing a set \(P\) of points in the Euclidean plane \(E^2\) can be solved using the same algorithm by first computing the convex hull enclosing the set of points \(P\) using any 2D convex hull algorithm; see Fig. 1 for an example.

First of all, the Main Algorithm 1 contains a loop which iterates over each edge of the convex polygon and sets the side \(C\) of the triangle flush with the selected edge. A necessary condition for finding a minimum enclosing triangle is that \(b\) is on the right chain and \(a\) on the left. The first step inside the loop is therefore to move the index \(b\) on the right chain using the AdvanceBToRightChain() subalgorithm. The initialisation of \(a\) was made in such a manner that it is on the left chain already.

Finally, if the found enclosing triangle is minimal (see IsLocalMinimalTriangle()) and its area is less than the area of the optimal enclosing triangle found so far then the optimal enclosing triangle is updated (see UpdateMinimumAreaEnclosingTriangle()).

In order to capture the execution of each step of the main algorithm a screencast was recorded. The screen was split up in two halves as shown in Fig. 2. The left half of the screen shows the current active line of code. Conversely, the right half of the screen illustrates the current progress of the algorithm as an image. For all execution steps this image contains the convex polygon and the points \(a\), \(b\) and \(c\). At particular execution steps the points \(\gamma _a\), \(\gamma _b\) or the minimum enclosing triangle are displayed as well.

Step by step execution of the minimum enclosing triangle algorithm implementation. The left side of the image shows the currently executed step of the main algorithm. The right side of the image illustrates the polygon and the points \(a\), \(b\) and \(c\)

For each value of n 100 random convex \(n\)-gons were generated using the Computational Geometry Algorithms Library (CGAL) (CGAL 2013). Thus, the total number of convex polygons in the benchmark is 10,000. Illustrative randomly generated 100-gons and their corresponding minimal area enclosing triangles are depicted in Fig. 4.

Randomly generated 100-gons and their corresponding minimal area enclosing triangles.Polygons are depicted in green and the enclosing triangles in red. Coordinates of the 2D points defining the polygons and their enclosing triangles are provided in Online Resource 1

The advantage of creating such a data set is that it could potentially be employed for testing the efficiency of other similar applications; see cspgoop/data/notes/2014/min_enclosing_triangle for more details.

The executions described in Sect. 5 verified empirically that the algorithm implementation scales (sub-)linearly with respect to \(n\). However, they did not assess the correctness of the computed minimal area enclosing triangle. In order to address this challenge three verification approaches were employed. Let us denote the expected optimal minimal area enclosing triangle by \(OT\), and the minimal enclosing triangle computed by the linear algorithm by \(CT\).

The first verification approach relies on generating regular convex n-gons, \(n = 3k\) (in our case \(k = \overline1, 3334\)), for which the minimal enclosing triangle is known to be equilateral. Given the coordinates of the 2D points defining the n-gon, \(OT\) can be automatically computed in \(O(1)\). If the minimal enclosing triangle \(CT\) computed by the algorithm implementation matches \(OT\) the algorithm implementation is considered valid. Otherwise it is invalid.

The second verification approach builds on the first one by applying affine transformations \(AT\) to each generated regular convex n-gon, and thus obtaining a new convex polygon; in our case \(AT =\) scaling by a factor of 1.5 with respect to both Ox and Oy, counterclockwise rotation by \(\pi / 4\). According to Klee and Laskowski (1985) the optimal enclosing triangle \(OT\) of a transformed polygon can be determined by applying the same affine transformations \(AT\) to the optimal enclosing triangle computed for the initial non-transformed regular polygon. Similarly, to the first verification approach \(OT\) can be determined in \(O(1)\). Moreover, the algorithm implementation is validated by checking if \(OT\) matches \(CT\). 041b061a72


Welcome to the group! You can connect with other members, ge...
bottom of page