This repository has been archived on 2024-05-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ORB_SLAM3/Thirdparty/Pangolin/pyexamples/SimplePlot.py
PodmogilnyjIvan ff4acf84be raw
2021-12-03 03:34:31 -08:00

37 lines
1.1 KiB
Python

#!/usr/bin/env python3
import sys
sys.path.append('../build/src')
from OpenGL.GL import *
import pypangolin as pango
import math
def main():
win = pango.CreateWindowAndBind("main py_pangolin", 640, 480)
log = pango.DataLog()
log.SetLabels(["sin(t)", "cos(t)", "sin(t)+cos(t)"])
t=0;
tinc=0.01
plotter = pango.Plotter(log,0,4*math.pi/tinc,-2,2,math.pi/(4*tinc),0.5);
plotter.Track("$i")
plotter.AddMarker(pango.Marker.Vertical, -1000, pango.Marker.LessThan, pango.Colour.Blue().WithAlpha(0.2))
plotter.AddMarker(pango.Marker.Horizontal, 100, pango.Marker.GreaterThan, pango.Colour.Red().WithAlpha(0.2))
plotter.AddMarker(pango.Marker.Horizontal, 10, pango.Marker.Equal, pango.Colour.Green().WithAlpha(0.2))
plotter.SetBounds(pango.Attach(0), pango.Attach(1),
pango.Attach(0), pango.Attach(1))
pango.DisplayBase().AddDisplay(plotter)
while not pango.ShouldQuit():
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
log.Log(math.sin(t), math.cos(t), math.sin(t)+math.cos(t))
t+=tinc
pango.FinishFrame()
if __name__ == "__main__":
main()