Geometry – Determinant of Gauss (area of ​​a polygon of n vertices) how to implement

A very useful method for determining the area of ​​an irregular polygon is the Gaussian determinant.

The point is to draw the figure on a Cartesian plane and set the coordinates of each corner of the polygon.

Drawing of the selection and enumeration of the irregular pentagon points for the Gaussian determinant.

Each of them is randomly selected and the pairs are put into the following formula. The polygon must be counter-clockwise, bearing in mind that the first coordinate pair corresponds to the selected vertex, and after all vertices have been driven counterclockwise, the last pair must be the initial torque

The vertices of the polygon are: (x1, y1), (x2, y2), …, (xN, yN). The formula is as follows:


Formula of the irregular polygon surface with the Gaussian determinant

If you solve it with the known method, you have quickly found the area of ​​the irregular polygon.

This method applies to all polygons with any number of sides, both concave and convex polygons.

My question is how can I create a script that asks me
a) number of vertices
b) Ask me to enter the n points between these n vertices
This is
$$ (x_1, y_1) $$
$$ (x_2, y_2) $$
$$ (x_n, y_n) $$
c) Can calculate the area with the given formula

n = input ("number of vertices", n)
(Input (x1, y1), (x2, y2) ….. (xn, yn)) ?? ??
A = (1/2) det (x1, y1), (x2, y2) ….. (xn, yn) ???

can you help me ? I searched the forum, but I can not find an example that I can adapt

c – Implement the status quitter for NIST DRBG and other crypto primitives using a macro

As a personal leisure project, I implement a set of cryptographic primitives with symmetric keys.

One thing I've left vacant for a long time is the eraser I'm adding now.

I intend it to be a macro so it does not require an extra object file; The macro should be instruction-like (according to this question) so that its use matches those of other lines.

Here is my current code:

#define ERASE_STATES(buf, len)                  
    do {                                        
        for(uintptr_t i=0; i

There are a few things that I'm not sure about.

  1. len is a cardinal and it would probably be one size_t, but i Is an atomic number, I should use too size_tor change to another type for reasons of semantic consistency? (I use uintptr_t right now.)

  2. The signature of the type char is explicitly undefined by default, but can it still be used without affecting the semantic consistency, as a generic type representing a byte if it is not assigned negative values?

  3. Anything else I missed?

Java – Why can not I implement multiple interfaces?

I'm creating a game in which objects implement interfaces for animations. I have a parent interface for the animations. Here is a shortened version:

public interface Animates {
    S createAnimator(long animationTime);

In addition, I have several interfaces that extend this interface. Two examples:

public interface AnimatesPaint extends Animates {
    PaintAnimator createPaintAnimator(long animationTime);

    default PaintAnimator createAnimator(long animationTime) {
        return createPaintAnimator(animationTime);



public interface AnimatesPosition extends Animates {
    PositionAnimator createPositionAnimator(long animationTime);

    default PositionAnimator createAnimator(long animationTime) {
        return createPositionAnimator(animationTime);


As you can see, the interfaces expand Animates overwrite the createAnimator Method to delegate the logic of createAnimator to the class that implements the interface.

The reason for this is that I want to have a screen element (that can be animated) that implements several animation surfaces (for example both) AnimatesPosition to move the element and AnimatesPaint change its color).

This does not seem to work. If I implement both in a class (see screenshot below), I get the compile error:

createAnimator (long) in AnimatesPaint collides with
createAnimator (long) in AnimatesPosition; try to use
incompatible return types

Here's an example of a class that implements both Animates interfaces:

public class ScreenElement implements AnimatesPaint, AnimatesPosition {
    PositionAnimator createPositionAnimator(long animationTime) {
        return new PositionAnimator(animationTime);
    PaintAnimator createPaintAnimator(long animationTime) {
        return new PaintAnimator(animationTime);

What I do not understand is that both AnimatesPaint and AnimatesPosition already implement createAnimator, However, the error message seems to indicate this createAnimator must also be implemented by ScreenElement!

Where is my logic going wrong?

Finally, I want to have a generic method that can initiate any kind of animation. For example:

public class AnimationStarter {

    public void startAnimation(S animates, T start, T target, long animationTime) {
        Animator animator = animates.createAnimator(animationTime);
        animator.init(start, target);

Reference Request – Empirical measurement of plant noise to implement the Kalman filter using chirp data

I want to implement a Kalman filter for the system:
$$ dot x = Ax + Bu + w_p, qquad y = Cx + w_m $$
Where $ w_p $ and $ w_m $ are the system noise and the measurement noise, both of which are white noise with covariance matrices
$$ E (w_p (t) w_p ^ T (t + tau)) = S_p Delta ( tau), qquad
E (w_m (t) w_m ^ T (t + tau)) = S_m delta ( tau). $$

Before I can implement the filter, I have to know $ A $. $ B $. $ C $. $ S_p $ and $ S_m $, I think I have found a way to do this empirically using chirp data. I am interested in an indication of such or another method to obtain these matrices (and especially the covariance matrices).

Usability – Implement filters as tabs in a web dashboard

1. In a modern, well-programmed system, filters should work dynamically in real time, but due to system limitations:

For a map with saved settings:

  • a) Suppose we are looking for the target element with the
    X Y Z parameter

  • b) We want to see the results, so click on Apply (the card will be closed)
    automatically and we see the result)

  • c) We see 30 results, but we decide to change them Y. Parameters
    Limit the results

In this situation, I think that after opening the window with filters, the XYZ parameters should be saved from the previous operation (for example, in local storage) – but this requires analyzing multiple scenarios and discussing the most appropriate solution.

Maybe the filters should be redesigned? (as a sliding div, not as a collision modal)

2. It should retain the previous state (the storage mechanism is often used in multi-level processes)

3. Limit the source of truth and minimize the solution – if the solution causes inconsistencies in the context of the design, implementation becomes even more difficult.
In particular, I suggest keep a card and remember the condition

4. hmm, create a new filter screen? limit their number to the essentials?
This point will take much more time

Functions – Implement the general tree c ++

I'm having trouble implementing the common tree, creating a tree node with a char info and an array of pointers named children, creating a structure called root that contains 19 nodes, and I do not need the root so that information does the algorithm well create (I think). but when I call the function insertletra, so putting the first letter to the tree tells me that there are problems in the way I set the data here, I leave the algorithm, so specifically the error

                        struct nodo{
                            char dato;
                            nodo *hijo(10);

                        struct raiz{
                            nodo *hijo(19);

                        void inserttree(string texto);

                        nodo *crearnodo(char c);

                        void insertarletra(raiz *&raiz, char c);

                        int main(){
                            ifstream archivo;
                            char c;
                            string texto;
                            string n;
                            int x,z;
                            bool billetevalido=false;
                            long long y;
                            raiz arbol();



                        nodo *crearnodo(char c){

                            nodo *nuevo_nodo = new nodo();

                            nuevo_nodo->dato = c;
                            for(int i=0;i<19;i++){
                                nuevo_nodo->hijo(i)= NULL;
                            return nuevo_nodo;


                        void insertarletra(raiz *&raiz,char c){
                            for(int i=0;i<19;i++){
                                    for (int i=0;i<19;i++){
                                        if (raiz->hijo(i)->dato!=c && 

Design – How can I implement the Maker Checker principle?

I am looking for ways to implement the Maker Checker principle for different classes in our corporate repository. Basically, the following rules apply:

  • An entity is an object that you want to display on a website (for example, a blog post).
  • There is a creator of an entity with appropriate permissions / roles (e.g. ROLE_POST_CREATOR) (in original question context manufacturer)
  • There is an approver of an entity with appropriate permissions / roles (e.g. ROLE_POST_APPROVER) and unlike the author of the paper (in the original questionary context examiner)
  • The position has two statuses (DRAFTED and APPROVED) and only posts with APPROVED Status can be seen on the website

So far, so good. It gets complicated here:

  • It should not only be approved that the post is displayed on the website, but also that it is removed from the website (deleted) or updated on the website. In other words, updating a post should not affect the currently displayed post, but only display the new version after approval. The same applies to deleting (deleting a post is only a request to delete a post, it should only be deleted after the approval).

Modeling -say in Java is pretty simple:

class SampleClass {

    private User maker;

    private User checker;

    private Status status;

However, saving to a database (especially an update) is not the case. Here are a few ideas I could come up with:

  • For example, for each entity, I could have two tables SAMPLE_CLASS and SAMPLE_CLASS_REQUESTSBasically, I would duplicate all fields from SAMPLE_CLASS to SAMPLE_CLASS_REQUESTS with the exception of the updated field. With permission of _REQUESTS I would then delete it from this table and move the updated version to SAMPLE_CLASS,

This is a very viable option, although, for example, new entity creation is required SampleClassRequest for the Checker users. This is a viable option, except that a new table is created for each entity to implement the Maker Checker feature.

  • I could create new fields for SampleClass in the SAMPLE_CLASS Table to be updated. In this scenario, I should still generate SampleClassRequest However, it could avoid the overhead of generating a new table for each entity. However, this looks like a very bad database architecture.

How would you implement it? Basically, I'm looking for a sample library that can mimic design, behavior, and architecture, or a (Java) library that already contains this feature, or at least a tutorial / example method. Even an example of a database design coming from a database administrator would help.