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

rcs.posemath.PM_LINE Maven / Gradle / Ivy

Go to download

NIST Real-Time Control Systems Library including Posemath, NML communications and Java Plotter

There is a newer version: 2017.07.19
Show newest version
/* 
The NIST RCS (Real-time Control Systems) 
library is public domain software, however it is preferred
that the following disclaimers be attached.

Software Copywrite/Warranty Disclaimer

This software was developed at the National Institute of Standards and
Technology by employees of the Federal Government in the course of their
official duties. Pursuant to title 17 Section 105 of the United States
Code this software is not subject to copyright protection and is in the
public domain. NIST Real-Time Control System software is an experimental
system. NIST assumes no responsibility whatsoever for its use by other
parties, and makes no guarantees, expressed or implied, about its
quality, reliability, or any other characteristic. We would appreciate
acknowledgement if the software is used. This software can be
redistributed and/or modified freely provided that any derivative works
bear some notice that they are derived from it, and any modified
versions bear some notice that they have been modified.



 */

/*
 *       New Java File starts here.
 *       This file should be named PM_LINE.java
 */
// Set Package Name
package rcs.posemath;

// Import all NML, CMS, and RCS classes and interfaces
import rcs.nml.NMLFormatConverter;

/*
 *       Class definition for PM_LINE
 *       Automatically generated by RCS Java Diagnostics Tool.
 *       on Wed Jan 07 10:53:47 EST 1998
 */
public class PM_LINE implements Cloneable {

    public PM_LINE() {
        // just override the default constructor in-case someone wants to
        // use it as a bean.
    }

    public PM_LINE(PM_CARTESIAN _start,
            PM_CARTESIAN _end) throws PmException {
        PM_CARTESIAN diff = Posemath.subtract(_end, _start);
        uVec = Posemath.norm(diff);
        start = _start;
        end = _end;
    }

    public PM_CARTESIAN start = new PM_CARTESIAN();
    public PM_CARTESIAN end = new PM_CARTESIAN();
    public PM_CARTESIAN uVec = new PM_CARTESIAN();

    public void update(NMLFormatConverter nml_fc) {
        nml_fc.beginClass("PM_LINE", null);
        nml_fc.beginClassVar("start");
        start.update(nml_fc);
        nml_fc.endClassVar("start");
        nml_fc.beginClassVar("end");
        end.update(nml_fc);
        nml_fc.endClassVar("end");
        nml_fc.beginClassVar("uVec");
        uVec.update(nml_fc);
        nml_fc.endClassVar("uVec");
        nml_fc.endClass("PM_LINE", null);
    }

    @Override
    public PM_LINE clone() {
        PM_LINE ret = null;
        try {
            ret = (PM_LINE) super.clone();
            if (null != start) {
                ret.start = (PM_CARTESIAN) start.clone();
            }
            if (null != end) {
                ret.end = (PM_CARTESIAN) end.clone();
            }
            if (null != uVec) {
                ret.uVec = (PM_CARTESIAN) uVec.clone();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ret;
    }

    @Override
    public String toString() {
        return "{start=" + start + ",end=" + end + ",uVec=" + uVec + "}";
    }

    public PM_CARTESIAN intersection(PM_LINE l) throws PmException {
        return Posemath.intersection(this, l);
    }


    /**
     * @return the start
     */
    public PM_CARTESIAN getStart() {
        return start;
    }

    /**
     * @param start the start to set
     */
    public void setStart(PM_CARTESIAN start) {
        this.start = start;
    }

    /**
     * @return the end
     */
    public PM_CARTESIAN getEnd() {
        return end;
    }

    /**
     * @param end the end to set
     */
    public void setEnd(PM_CARTESIAN end) {
        this.end = end;
    }

    /**
     * @return the uVec
     */
    public PM_CARTESIAN getuVec() {
        return uVec;
    }

    /**
     * @param uVec the uVec to set
     */
    public void setuVec(PM_CARTESIAN uVec) {
        this.uVec = uVec;
    }



}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy