All Downloads are FREE. Search and download functionalities are using the official Maven repository.

us.ihmc.idl.generated.geometry.Polygon Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package us.ihmc.idl.generated.geometry;

import us.ihmc.communication.packets.Packet;
import us.ihmc.euclid.interfaces.Settable;
import us.ihmc.euclid.interfaces.EpsilonComparable;
import java.util.function.Supplier;
import us.ihmc.pubsub.TopicDataType;

public class Polygon extends Packet implements Settable, EpsilonComparable
{
   public us.ihmc.idl.IDLSequence.Object  points_;

   public Polygon()
   {
      points_ = new us.ihmc.idl.IDLSequence.Object (100, new us.ihmc.idl.generated.geometry.VectorPubSubType());

   }

   public Polygon(Polygon other)
   {
      this();
      set(other);
   }

   public void set(Polygon other)
   {
      points_.set(other.points_);
   }


   public us.ihmc.idl.IDLSequence.Object  getPoints()
   {
      return points_;
   }


   public static Supplier getPubSubType()
   {
      return PolygonPubSubType::new;
   }

   @Override
   public Supplier getPubSubTypePacket()
   {
      return PolygonPubSubType::new;
   }

   @Override
   public boolean epsilonEquals(Polygon other, double epsilon)
   {
      if(other == null) return false;
      if(other == this) return true;

      if (this.points_.size() != other.points_.size()) { return false; }
      else
      {
         for (int i = 0; i < this.points_.size(); i++)
         {  if (!this.points_.get(i).epsilonEquals(other.points_.get(i), epsilon)) return false; }
      }

      return true;
   }

   @Override
   public boolean equals(Object other)
   {
      if(other == null) return false;
      if(other == this) return true;
      if(!(other instanceof Polygon)) return false;

      Polygon otherMyClass = (Polygon) other;

      if (!this.points_.equals(otherMyClass.points_)) return false;

      return true;
   }

   @Override
   public java.lang.String toString()
   {
      StringBuilder builder = new StringBuilder();

      builder.append("Polygon {");
      builder.append("points=");
      builder.append(this.points_);
      builder.append("}");
      return builder.toString();
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy