]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Use inside diameter for eccentric reducer offset calculation 77/3977/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Mon, 9 Mar 2020 09:20:27 +0000 (11:20 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Mon, 9 Mar 2020 09:20:27 +0000 (11:20 +0200)
gitlab #104

Change-Id: I60b7056ac1bc30ecb85e46fd2b3cff4e3fcaf71d

org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/InlineComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipeRun.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java

index ca4ba8367259dd75eb864a253c57056d4491539a..ed4917df6717cfc78fd726afbafde98abe727423 100644 (file)
@@ -157,7 +157,7 @@ public class InlineComponent extends PipelineComponent {
        
        private void updateOffset() {
                if (!componentCalculatedOffset && getControlPoint().isOffset()) {
-                       getControlPoint().setOffset(getPipeRun().getPipeDiameter()*0.5 - getAlternativePipeRun().getPipeDiameter()*0.5);
+                       getControlPoint().setOffset(getPipeRun().getInsideDiameter()*0.5 - getAlternativePipeRun().getInsideDiameter()*0.5);
                }
        }
 
index 0284d1c7b5e13a1a32d56cab5c9b54f544ebf5ab..0a6e58c07c365f664263291aeee53787474f295d 100644 (file)
@@ -120,6 +120,10 @@ public class PipeRun extends P3DParentNode<IP3DNode> {
                firePropertyChanged(Plant3D.URIs.HasPipeThickness);
        }
        
+       public double getInsideDiameter() {
+               return pipeDiameter - 2 * pipeThickness;
+       }
+       
        @RelatedElementsAdd(Plant3D.URIs.children)
        public void addChild(PipelineComponent node) {
                addNode(Plant3D.URIs.children,node);
index f0621fdd2ce7f76dad1490963b62ba73583065a1..6afa937d60f18c8cdbd38234ecfae6d3fbce360c 100644 (file)
@@ -616,8 +616,8 @@ public abstract class PipelineComponent extends GeometryNode {
                        }
                        
                        // Calculate center of mass for the frustum
-                       double r1 = getPipeRun().getPipeDiameter();
-                       double r2 = getAlternativePipeRun().getPipeDiameter();
+                       double r1 = getPipeRun().getInsideDiameter();
+                       double r2 = getAlternativePipeRun().getInsideDiameter();
                        
                        Vector3d p1 = new Vector3d(), p2 = new Vector3d();
                        pcp.getInlineControlPointEnds(p1, p2);
@@ -646,7 +646,7 @@ public abstract class PipelineComponent extends GeometryNode {
                        
                        double r = ((TurnComponent)this).getTurnRadius();
                        double a = pcp.getTurnAngle();
-                       double pipeRadius = pcp.getPipeRun().getPipeDiameter() / 2;
+                       double pipeRadius = pcp.getPipeRun().getInsideDiameter() / 2;
                        
                        // Unit vector in inlet flow direction
                        Vector3d inletDir = pcp.getPathLegDirection(Direction.PREVIOUS);
@@ -686,7 +686,7 @@ public abstract class PipelineComponent extends GeometryNode {
                if (pcp == null)
                        throw new IllegalStateException("No centroid defined");
                
-               double pipeRadius = getPipeRun().getPipeDiameter() / 2;
+               double pipeRadius = getPipeRun().getInsideDiameter() / 2;
                
                switch (pcp.getType()) {
                case INLINE:
@@ -698,7 +698,7 @@ public abstract class PipelineComponent extends GeometryNode {
                        
                        // Calculate center of mass for the frustum
                        double r1 = pipeRadius;
-                       double r2 = getAlternativePipeRun().getPipeDiameter() / 2;
+                       double r2 = getAlternativePipeRun().getInsideDiameter() / 2;
                        return pcp.getLength() * Math.PI * (r1*r1 + r1*r2 + r2*r2) / 4;
                case TURN: {
                        double r = ((TurnComponent)this).getTurnRadius();