Exemplo n.º 1
0
  public final void compute() {

    if (input[0].isDefined()) {
      path.pathChanged(P);
      P.updateCoords();
    } else {
      P.setUndefined();
    }
  }
  public int getDefaultType(GeoElement geo) {

    switch (geo.getGeoClassType()) {
      case POINT3D:
        if (geo.isIndependent()) {
          return DEFAULT_POINT3D_FREE;
        } else {
          GeoPoint3D p = (GeoPoint3D) geo;
          if (p.hasPath()) return DEFAULT_POINT3D_ON_PATH;
          else if (p.hasRegion()) return DEFAULT_POINT3D_IN_REGION;
          else return DEFAULT_POINT3D_DEPENDENT;
        }

      case ANGLE3D:
        return DEFAULT_ANGLE3D;

      case LINE3D:
        if (((GeoLine3D) geo).isIntersection()) return DEFAULT_LINE3D_INTERSECTION;
        else return DEFAULT_LINE3D;
      case SEGMENT3D:
        if (((GeoSegment3D) geo).isIntersection()) return DEFAULT_SEGMENT3D_INTERSECTION;
        else return DEFAULT_SEGMENT3D;
      case RAY3D:
        if (((GeoRay3D) geo).isIntersection()) return DEFAULT_RAY3D_INTERSECTION;
        else return DEFAULT_RAY3D;
      case AXIS3D:
        return DEFAULT_AXIS3D;
      case VECTOR3D:
        return DEFAULT_VECTOR3D;
      case CONIC3D:
        if (((GeoConic3D) geo).isIntersection()) return DEFAULT_CONIC3D_INTERSECTION;
        else return DEFAULT_CONIC3D;
      case CURVECARTESIAN3D:
        return DEFAULT_CURVECARTESIAN3D;
      case PLANE3D:
        return DEFAULT_PLANE3D;
      case POLYGON3D:
        return DEFAULT_POLYGON3D;
      case POLYHEDRON:
        return DEFAULT_POLYHEDRON;
      case QUADRIC:
      case QUADRIC_PART:
        return DEFAULT_QUADRIC;
      case QUADRIC_LIMITED:
        return DEFAULT_QUADRIC_LIMITED;
      case FUNCTION_NVAR:
        return DEFAULT_FUNCTION_NVAR;
      case SURFACECARTESIAN3D:
        return DEFAULT_SURFACECARTESIAN3D;

      default:
        return super.getDefaultType(geo);
    }
  }
Exemplo n.º 3
0
  public AlgoPoint3DOnPath(
      Construction cons, String label, Path path, double x, double y, double z) {
    super(cons);
    this.path = path;
    P = new GeoPoint3D(cons, path);

    P.setCoords(x, y, z, 1.0);
    // P.setWillingCoords(x, y, z, 1);
    // path.pointChanged(P);

    setInputOutput(); // for AlgoElement

    // compute
    compute();
    P.setLabel(label);
  }
Exemplo n.º 4
0
    /**
     * Sets the point to be used in the distance function
     *
     * @param p point
     */
    public void setDistantPoint(GeoPointND p) {

      if (p.isGeoElement3D()) {
        GeoPoint3D p3D = (GeoPoint3D) p;

        if (p3D.hasWillingCoords()) {
          distCoords = p3D.getWillingCoords();
        } else {
          distCoords = p3D.getInhomCoordsInD3();
        }

        distDirection = p3D.getWillingDirection(); // maybe undefined

      } else {
        distCoords = p.getInhomCoordsInD3();
        distDirection = null;
      }
    }
  public void createDefaultGeoElements() {
    super.createDefaultGeoElements();

    // angle
    GeoAngle3D angle = new GeoAngle3D(cons);
    angle.setVisualStyle(super.getDefaultGeo(DEFAULT_ANGLE));
    angle.setAngleStyle(GeoAngle.ANGLE_ISNOTREFLEX);
    defaultGeoElements.put(DEFAULT_ANGLE3D, angle);

    // free point
    GeoPoint3D freePoint = new GeoPoint3D(cons);
    freePoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    freePoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    freePoint.setLocalVariableLabel("Point3D" + strFree);
    freePoint.setObjColor(colPoint);
    // freePoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_FREE, freePoint);

    // dependent point
    GeoPoint3D depPoint = new GeoPoint3D(cons);
    depPoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    depPoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    depPoint.setLocalVariableLabel("Point3D" + strDependent);
    depPoint.setObjColor(colDepPoint);
    // depPoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_DEPENDENT, depPoint);

    // point on path
    GeoPoint3D pathPoint = new GeoPoint3D(cons);
    pathPoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    pathPoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    pathPoint.setLocalVariableLabel("Point3DOn");
    pathPoint.setObjColor(colPathPoint);
    // pathPoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_ON_PATH, pathPoint);

    // point in region
    GeoPoint3D regionPoint = new GeoPoint3D(cons);
    regionPoint.setPointSize(EuclidianStyleConstants.DEFAULT_POINT_SIZE);
    regionPoint.setPointStyle(EuclidianStyleConstants.POINT_STYLE_DOT);
    regionPoint.setLocalVariableLabel("Point3DInRegion");
    regionPoint.setObjColor(colRegionPoint);
    // regionPoint.setLabelOffset(5, -5);
    defaultGeoElements.put(DEFAULT_POINT3D_IN_REGION, regionPoint);

    // line
    GeoLine3D line = new GeoLine3D(cons);
    // line.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    line.setLocalVariableLabel("Line3D");
    defaultGeoElements.put(DEFAULT_LINE3D, line);

    // segment
    GeoSegment3D segment = new GeoSegment3D(cons);
    // segment.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    segment.setLocalVariableLabel("Segment3D");
    defaultGeoElements.put(DEFAULT_SEGMENT3D, segment);

    // ray
    GeoRay3D ray = new GeoRay3D(cons);
    // ray.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    ray.setLocalVariableLabel("Ray3D");
    defaultGeoElements.put(DEFAULT_RAY3D, ray);

    // line intersection
    GeoLine3D lineIntersection = new GeoLine3D(cons);
    // line.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    lineIntersection.setLocalVariableLabel("Line3D" + strIntersection);
    lineIntersection.setObjColor(colIntersectionLine);
    defaultGeoElements.put(DEFAULT_LINE3D_INTERSECTION, lineIntersection);

    // segment intersection
    GeoSegment3D segmentIntersection = new GeoSegment3D(cons);
    // segment.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    segmentIntersection.setLocalVariableLabel("Segment3D" + strIntersection);
    lineIntersection.setObjColor(colIntersectionLine);
    defaultGeoElements.put(DEFAULT_SEGMENT3D_INTERSECTION, segmentIntersection);

    // ray intersection
    GeoRay3D rayIntersection = new GeoRay3D(cons);
    // ray.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    rayIntersection.setLocalVariableLabel("Ray3D" + strIntersection);
    lineIntersection.setObjColor(colIntersectionLine);
    defaultGeoElements.put(DEFAULT_RAY3D_INTERSECTION, rayIntersection);

    // axis
    GeoAxis3D axis = new GeoAxis3D(cons);
    // axis.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_SHORT);
    axis.setLocalVariableLabel("Axis3D");
    defaultGeoElements.put(DEFAULT_AXIS3D, axis);

    // vector 3D
    GeoVector3D vector = new GeoVector3D(cons);
    // vector.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    vector.setObjColor(colVector);
    vector.setLocalVariableLabel("Vector3D");
    defaultGeoElements.put(DEFAULT_VECTOR3D, vector);

    // conic
    GeoConic3D conic = new GeoConic3D(cons);
    conic.setLocalVariableLabel("Conic3D");
    // conic.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    conic.setObjColor(colConic3D);
    defaultGeoElements.put(DEFAULT_CONIC3D, conic);

    // conic intersection
    GeoConic3D conicIntersection = new GeoConic3D(cons);
    conicIntersection.setLocalVariableLabel("Conic3D" + strIntersection);
    conicIntersection.setObjColor(colIntersectionCurve);
    defaultGeoElements.put(DEFAULT_CONIC3D_INTERSECTION, conicIntersection);

    // curve
    GeoCurveCartesian3D curve = new GeoCurveCartesian3D(cons);
    curve.setLocalVariableLabel("Curve3D");
    // curve.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_LONG);
    curve.setObjColor(colCurveCartesian3D);
    defaultGeoElements.put(DEFAULT_CURVECARTESIAN3D, curve);

    // plane
    GeoPlane3D plane = new GeoPlane3D(cons);
    plane.setLocalVariableLabel("Plane3D");
    plane.setObjColor(colPlane3D);
    plane.setAlphaValue(DEFAULT_PLANE3D_ALPHA);
    plane.setLineThickness(DEFAULT_PLANE3D_GRID_THICKNESS);
    plane.setFading(DEFAULT_PLANE3D_FADING);
    // plane.setLineType(EuclidianStyleConstants.LINE_TYPE_DASHED_SHORT);
    defaultGeoElements.put(DEFAULT_PLANE3D, plane);

    // polygon
    GeoPolygon3D polygon = new GeoPolygon3D(cons, null, null, false);
    polygon.setLocalVariableLabel("Polygon3D");
    polygon.setObjColor(colPolygon3D);
    polygon.setAlphaValue(DEFAULT_POLYGON3D_ALPHA);
    defaultGeoElements.put(DEFAULT_POLYGON3D, polygon);

    // polyhedron
    GeoPolyhedron polyhedron = new GeoPolyhedron(cons);
    polyhedron.setLocalVariableLabel("Polyhedron");
    polyhedron.setObjColor(colPolyhedron);
    polyhedron.setAlphaValue(DEFAULT_POLYGON3D_ALPHA);
    defaultGeoElements.put(DEFAULT_POLYHEDRON, polyhedron);

    // quadric
    GeoQuadric3D quadric = new GeoQuadric3D(cons);
    quadric.setLocalVariableLabel("Quadric");
    quadric.setObjColor(colQuadric);
    quadric.setAlphaValue(DEFAULT_QUADRIC_ALPHA);
    defaultGeoElements.put(DEFAULT_QUADRIC, quadric);

    // limited quadric
    GeoQuadric3D limitedQuadric = new GeoQuadric3D(cons);
    limitedQuadric.setLocalVariableLabel("QuadricLimited");
    limitedQuadric.setObjColor(colPolyhedron);
    limitedQuadric.setAlphaValue(DEFAULT_QUADRIC_LIMITED_ALPHA);
    defaultGeoElements.put(DEFAULT_QUADRIC_LIMITED, limitedQuadric);

    // function n var
    GeoFunctionNVar function = new GeoFunctionNVar(cons);
    function.setLocalVariableLabel("function");
    function.setObjColor(colQuadric);
    function.setAlphaValue(DEFAULT_QUADRIC_ALPHA);
    defaultGeoElements.put(DEFAULT_FUNCTION_NVAR, function);

    // surface
    GeoSurfaceCartesian3D surface = new GeoSurfaceCartesian3D(cons);
    surface.setLocalVariableLabel("surface");
    surface.setObjColor(colQuadric);
    surface.setAlphaValue(DEFAULT_QUADRIC_ALPHA);
    defaultGeoElements.put(DEFAULT_SURFACECARTESIAN3D, surface);
  }