1

2
# ROV visualization
3

4
"""
5
    $(SIGNATURES)
6

7
Brings model data into context, but generating or loading meshes, Geometries, etc as required by requested model,
8
and must still be drawn with the Visualizer object using mdl(vis).
9
"""
10
function loadmodel(model::Symbol=:rov;
11
    color=RGBA(0., 1.0, 0.5, 0.3),
12
    offset = Translation(0.,0,0)  LinearMap(Rotations.Quat(1.0,0,0,0))  )
13
  #
14 0
  if model==:rov
15 0
    @show file = joinpath(dirname(@__FILE__), ".." , "data", "models", "rov3.obj")
16 0
    rov = load(file)
17 0
    rovdata = GeometryData(rov)
18 0
    rovdata.color = color
19 0
    offset = Translation(-0.5,0,0.25)  LinearMap(Rotations.Quat(0,0,0,1.0))
20 0
    return DrawROV(rovdata, 99, :rov, offset)
21 0
  elseif model == :scene01
22 0
    boxdata = GeometryData(HyperRectangle(Vec(4.0,0,0), Vec(5.0,5.0,0)), RGBA(0.5,0.1,0.0,0.5))
23
    # boxdata.color =
24 0
    offset = Translation(0.0,0,0)  LinearMap(CoordinateTransformations.AngleAxis(0.0,0,0,1.0))
25 0
    return DrawScene(boxdata, :scene01, offset)
26 0
  elseif model == :dock
27 0
    @show file = joinpath(dirname(@__FILE__), ".." , "data", "models", "dock.obj")
28 0
    rov = load(file)
29 0
    rovdata = GeometryData(rov)
30 0
    rovdata.color = color
31 0
    offset = Translation(0.0,0,0)  LinearMap(Rotations.Quat(1.0,0,0,0.0))
32 0
    return DrawScene(rovdata, :dock, offset)
33
  else
34 0
    error("Don't recognize requested $(string(model)) model.")
35
  end
36
end
37

38

39
# t∈[0,1], about
40
function parameterizeArcAffineMap(t, as::ArcPointsRangeSolve; initrot::Rotation=Rotations.Quat(1.0,0,0,0))
41 0
  the = t*as.angle
42 0
  rot = Rotations.AngleAxis(the, as.axis...)
43 0
  dp = as.x1-as.center
44 0
  arc = LinearMap(rot)  Translation(dp...)
45

46 0
  cent = Translation(as.center)
47 0
  return cent  arc  LinearMap(initrot)
48
end
49

50

51

52
# as = ArcPointsRangeSolve(
53
#       [0.0;0;0.0],
54
#       [0.0;6.0;6.0],
55
#       [0.0;12.0;0.0], 6.0)
56
# findaxiscenter!(as)
57
# # @show as.center, as.axis, as.angle, as.r
58
# animatearc(vc, rovt, as, initrot=Rotations.AngleAxis(pi/2,0,0,1.0))
59
#
60
#
61
# as = ArcPointsRangeSolve(
62
#       [2.5;-1;0.0],
63
#       [-4.5;4.0;0.0],
64
#       [9.5;6.0;0.0], 7.0)
65
# findaxiscenter!(as)
66
# # @show as.center, as.axis, as.angle, as.r
67
# animatearc(vc, rovt, as, initrot=Rotations.AngleAxis(pi/2,0,0,1.0))
68
#
69

70

71

72

73

74
#

Read our documentation on viewing source code .

Loading