Exemple #1
0
            public virtual void compute_global_transforms(Transform3Cache tcache)
            {
                //System.err.println("Computing coordinate for " + this);

                Transform3 t = _transform; // local transform

                Element.Builder p = this._parent;
                while (p != null)
                {
                    t = Transform3.compose(p._transform, t);
                    p = p._parent;
                }

                tcache.put_local_2_global_transform(this._id, t);           // Local to global
                tcache.put_global_2_local_transform(this._id, t.inverse()); // Global to local
            }
            /**
             * Sets element position using global coordinate system
             * Needs a prior call to build so we have the transformations needed
             */
            public OpticalSystem updatePosition(Element.Builder e, Vector3 v)
            {
                // FIXME
                if (_transform3Cache == null)
                {
                    throw new InvalidOperationException("build() must be called prior to updating position");
                }
                if (e.parent() != null)
                {
                    e.localPosition(_transform3Cache.global_2_local_transform(e.parent().id()).transform(v));
                }
                else
                {
                    e.localPosition(v);
                }

                return(build());
            }
Exemple #3
0
 public Builder parent(Element.Builder parent)
 {
     this._parent = parent;
     return(this);
 }
 public Builder add(Element.Builder element)
 {
     this._elements.Add(element);
     return(this);
 }
Exemple #5
0
 public Group.Builder add(Element.Builder element)
 {
     this._elements.Add(element);
     element.parent(this);
     return(this);
 }